@micromag/viewer 0.3.179 → 0.3.183
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 +17 -13
- package/es/index.js +1571 -1163
- package/lib/index.js +1585 -1177
- package/package.json +10 -10
package/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
6
|
+
import { Link, BrowserRouter } from 'react-router-dom';
|
|
7
7
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
8
8
|
import { usePlaybackContext, useViewerWebView, useViewerInteraction, VisitorProvider, ScreenSizeProvider, ViewerProvider, useRoutes, useRoutePush, GoogleKeysProvider, GoogleMapsClientProvider, FieldsProvider, ComponentsProvider, SCREENS_NAMESPACE, UserInteractionProvider, PlaybackProvider, TrackingProvider, RoutesProvider } from '@micromag/core/contexts';
|
|
9
9
|
import fieldsManager from '@micromag/fields/manager';
|
|
@@ -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 { Label, ScreenPreview, Screen, Button as Button$1, Meta, FontFaces } from '@micromag/core/components';
|
|
19
|
+
import { useDimensionObserver, useTrackEvent, useDragProgress, useMediaProgress, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen } from '@micromag/core/hooks';
|
|
20
|
+
import { getStyleFromColor, easings, 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,393 @@ function useScreenInteraction() {
|
|
|
222
214
|
};
|
|
223
215
|
}
|
|
224
216
|
|
|
225
|
-
var styles$
|
|
226
|
-
|
|
227
|
-
var
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
217
|
+
var styles$g = {"container":"micromag-viewer-buttons-button-container","asLink":"micromag-viewer-buttons-button-asLink","icon":"micromag-viewer-buttons-button-icon","label":"micromag-viewer-buttons-button-label","withIcon":"micromag-viewer-buttons-button-withIcon","right":"micromag-viewer-buttons-button-right","icon-right":"micromag-viewer-buttons-button-icon-right","withIconColumns":"micromag-viewer-buttons-button-withIconColumns","linkDisabled":"micromag-viewer-buttons-button-linkDisabled"};
|
|
218
|
+
|
|
219
|
+
var _excluded$8 = ["type", "theme", "size", "href", "external", "direct", "target", "label", "children", "focusable", "active", "icon", "iconPosition", "disabled", "loading", "disableOnLoading", "withoutTheme", "asLink", "onClick", "className", "iconClassName", "labelClassName", "refButton"];
|
|
220
|
+
var propTypes$n = {
|
|
221
|
+
type: PropTypes.string,
|
|
222
|
+
theme: PropTypes$1.buttonTheme,
|
|
223
|
+
size: PropTypes$1.buttonSize,
|
|
224
|
+
href: PropTypes.string,
|
|
225
|
+
external: PropTypes.bool,
|
|
226
|
+
direct: PropTypes.bool,
|
|
227
|
+
target: PropTypes.string,
|
|
228
|
+
label: PropTypes$1.label,
|
|
229
|
+
children: PropTypes$1.label,
|
|
230
|
+
focusable: PropTypes.bool,
|
|
231
|
+
active: PropTypes.bool,
|
|
232
|
+
icon: PropTypes.node,
|
|
233
|
+
iconPosition: PropTypes.oneOf(['left', 'right', 'inline']),
|
|
234
|
+
disabled: PropTypes.bool,
|
|
235
|
+
loading: PropTypes.bool,
|
|
236
|
+
disableOnLoading: PropTypes.bool,
|
|
237
|
+
withoutTheme: PropTypes.bool,
|
|
238
|
+
asLink: PropTypes.bool,
|
|
231
239
|
className: PropTypes.string,
|
|
232
|
-
|
|
233
|
-
|
|
240
|
+
iconClassName: PropTypes.string,
|
|
241
|
+
labelClassName: PropTypes.string,
|
|
242
|
+
onClick: PropTypes.func,
|
|
243
|
+
refButton: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
244
|
+
current: PropTypes.any // eslint-disable-line
|
|
245
|
+
|
|
246
|
+
})])
|
|
234
247
|
};
|
|
235
|
-
var defaultProps$
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
248
|
+
var defaultProps$n = {
|
|
249
|
+
type: 'button',
|
|
250
|
+
theme: null,
|
|
251
|
+
size: null,
|
|
252
|
+
href: null,
|
|
253
|
+
external: false,
|
|
254
|
+
direct: false,
|
|
255
|
+
target: '_blank',
|
|
256
|
+
label: null,
|
|
257
|
+
children: null,
|
|
258
|
+
focusable: true,
|
|
259
|
+
active: false,
|
|
260
|
+
icon: null,
|
|
261
|
+
iconPosition: 'inline',
|
|
262
|
+
disabled: false,
|
|
263
|
+
loading: false,
|
|
264
|
+
disableOnLoading: true,
|
|
265
|
+
withoutTheme: false,
|
|
266
|
+
asLink: false,
|
|
239
267
|
className: null,
|
|
240
|
-
|
|
241
|
-
|
|
268
|
+
iconClassName: null,
|
|
269
|
+
labelClassName: null,
|
|
270
|
+
onClick: null,
|
|
271
|
+
refButton: null
|
|
242
272
|
};
|
|
243
273
|
|
|
244
|
-
var
|
|
245
|
-
var
|
|
274
|
+
var Button = function Button(_ref) {
|
|
275
|
+
var _ref2;
|
|
246
276
|
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
277
|
+
var type = _ref.type,
|
|
278
|
+
theme = _ref.theme;
|
|
279
|
+
_ref.size;
|
|
280
|
+
var href = _ref.href,
|
|
281
|
+
external = _ref.external,
|
|
282
|
+
direct = _ref.direct,
|
|
283
|
+
target = _ref.target,
|
|
284
|
+
label = _ref.label,
|
|
285
|
+
children = _ref.children,
|
|
286
|
+
focusable = _ref.focusable;
|
|
287
|
+
_ref.active;
|
|
288
|
+
var icon = _ref.icon,
|
|
289
|
+
iconPosition = _ref.iconPosition,
|
|
290
|
+
disabled = _ref.disabled,
|
|
291
|
+
loading = _ref.loading,
|
|
292
|
+
disableOnLoading = _ref.disableOnLoading;
|
|
293
|
+
_ref.withoutTheme;
|
|
294
|
+
var asLink = _ref.asLink,
|
|
295
|
+
onClick = _ref.onClick,
|
|
250
296
|
className = _ref.className,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
297
|
+
iconClassName = _ref.iconClassName,
|
|
298
|
+
labelClassName = _ref.labelClassName,
|
|
299
|
+
refButton = _ref.refButton,
|
|
300
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
301
|
+
|
|
302
|
+
var finalLabel = label || children;
|
|
303
|
+
var text = finalLabel !== null ? /*#__PURE__*/React.createElement(Label, null, finalLabel) : null;
|
|
304
|
+
var hasChildren = label !== null && children !== null;
|
|
305
|
+
var hasIcon = icon !== null;
|
|
306
|
+
var hasInlineIcon = hasIcon && (iconPosition === 'inline' || text === null);
|
|
307
|
+
var hasIconColumns = hasIcon && !hasInlineIcon;
|
|
308
|
+
var buttonClassNames = classNames([styles$g.container, styles$g["icon-".concat(iconPosition)], (_ref2 = {}, _defineProperty(_ref2, styles$g.withIcon, hasIcon), _defineProperty(_ref2, styles$g.withIconColumns, hasIconColumns), _defineProperty(_ref2, styles$g.withText, text !== null), _defineProperty(_ref2, styles$g.isLink, href !== null), _defineProperty(_ref2, styles$g.asLink, asLink), _defineProperty(_ref2, styles$g.isDisabled, disabled), _defineProperty(_ref2, styles$g.isLoading, loading), _defineProperty(_ref2, className, className !== null), _ref2)]);
|
|
309
|
+
|
|
310
|
+
var _ref3 = theme || {},
|
|
311
|
+
_ref3$colors = _ref3.colors,
|
|
312
|
+
colors = _ref3$colors === void 0 ? null : _ref3$colors;
|
|
313
|
+
|
|
314
|
+
var _ref4 = colors || {},
|
|
315
|
+
_ref4$primary = _ref4.primary,
|
|
316
|
+
brandPrimaryColor = _ref4$primary === void 0 ? null : _ref4$primary;
|
|
317
|
+
|
|
318
|
+
var primaryColor = getStyleFromColor(brandPrimaryColor, 'color');
|
|
319
|
+
|
|
320
|
+
var buttonStyles = _objectSpread({}, primaryColor);
|
|
321
|
+
|
|
322
|
+
var content = /*#__PURE__*/React.createElement(React.Fragment, null, hasInlineIcon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
323
|
+
className: classNames([styles$g.icon, _defineProperty({}, iconClassName, iconClassName !== null)])
|
|
324
|
+
}, icon), text !== null ? /*#__PURE__*/React.createElement("span", {
|
|
325
|
+
className: classNames([styles$g.label, _defineProperty({}, labelClassName, labelClassName !== null)])
|
|
326
|
+
}, text) : null) : null, hasIconColumns ? /*#__PURE__*/React.createElement(React.Fragment, null, iconPosition === 'left' ? /*#__PURE__*/React.createElement("span", {
|
|
327
|
+
className: classNames([styles$g.icon, styles$g.left, _defineProperty({}, iconClassName, iconClassName !== null && iconPosition === 'left')])
|
|
328
|
+
}, icon) : null, /*#__PURE__*/React.createElement("span", {
|
|
329
|
+
className: classNames([styles$g.center, styles$g.label, _defineProperty({}, labelClassName, labelClassName !== null)])
|
|
330
|
+
}, text), iconPosition === 'right' ? /*#__PURE__*/React.createElement("span", {
|
|
331
|
+
className: classNames([styles$g.icon, styles$g.right, _defineProperty({}, iconClassName, iconClassName !== null && iconPosition === 'right')])
|
|
332
|
+
}, icon) : null, hasChildren ? children : null) : null, !hasIcon ? text : null, hasChildren ? children : null);
|
|
333
|
+
|
|
334
|
+
if (href !== null) {
|
|
335
|
+
var linkClassNames = classNames([buttonClassNames, _defineProperty({
|
|
336
|
+
disabled: disabled
|
|
337
|
+
}, styles$g.linkDisabled, disabled)]);
|
|
338
|
+
return external || direct ? /*#__PURE__*/React.createElement("a", Object.assign({}, props, {
|
|
339
|
+
href: disabled ? null : href,
|
|
340
|
+
className: linkClassNames,
|
|
341
|
+
style: buttonStyles,
|
|
342
|
+
onClick: onClick,
|
|
343
|
+
target: external ? target : null,
|
|
344
|
+
ref: refButton,
|
|
345
|
+
tabIndex: focusable ? '' : '-1'
|
|
346
|
+
}), content) : /*#__PURE__*/React.createElement(Link, Object.assign({}, props, {
|
|
347
|
+
to: href,
|
|
348
|
+
className: linkClassNames,
|
|
349
|
+
style: buttonStyles,
|
|
350
|
+
onClick: onClick,
|
|
351
|
+
ref: refButton,
|
|
352
|
+
tabIndex: focusable ? '' : '-1'
|
|
353
|
+
}), content);
|
|
354
|
+
}
|
|
257
355
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
356
|
+
return /*#__PURE__*/React.createElement("button", Object.assign({}, props, {
|
|
357
|
+
type: type,
|
|
358
|
+
className: buttonClassNames,
|
|
359
|
+
style: buttonStyles,
|
|
360
|
+
onClick: onClick,
|
|
361
|
+
disabled: disabled || disableOnLoading && loading,
|
|
362
|
+
ref: refButton,
|
|
363
|
+
tabIndex: focusable ? '0' : '-1'
|
|
364
|
+
}), content);
|
|
365
|
+
};
|
|
261
366
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}, /*#__PURE__*/React.createElement("h2", {
|
|
274
|
-
className: styles$c.heading
|
|
275
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
276
|
-
id: "oL4ueH",
|
|
277
|
-
defaultMessage: [{
|
|
278
|
-
"type": 0,
|
|
279
|
-
"value": "Share"
|
|
280
|
-
}]
|
|
281
|
-
})), /*#__PURE__*/React.createElement(Button, {
|
|
282
|
-
className: styles$c.close,
|
|
283
|
-
onClick: onCancel,
|
|
284
|
-
focusable: opened
|
|
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
|
-
}))));
|
|
367
|
+
Button.propTypes = propTypes$n;
|
|
368
|
+
Button.defaultProps = defaultProps$n;
|
|
369
|
+
|
|
370
|
+
var styles$f = {"container":"micromag-viewer-buttons-icon-button-container","icon":"micromag-viewer-buttons-icon-button-icon","label":"micromag-viewer-buttons-icon-button-label"};
|
|
371
|
+
|
|
372
|
+
var _excluded$7 = ["className"];
|
|
373
|
+
var propTypes$m = {
|
|
374
|
+
className: PropTypes.string
|
|
375
|
+
};
|
|
376
|
+
var defaultProps$m = {
|
|
377
|
+
className: null
|
|
298
378
|
};
|
|
299
379
|
|
|
300
|
-
|
|
301
|
-
|
|
380
|
+
var IconButton = function IconButton(_ref) {
|
|
381
|
+
var className = _ref.className,
|
|
382
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
302
383
|
|
|
303
|
-
|
|
384
|
+
return /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
385
|
+
className: classNames([styles$f.container, _defineProperty({}, className, className !== null)]),
|
|
386
|
+
labelClassName: styles$f.label,
|
|
387
|
+
iconClassName: styles$f.icon
|
|
388
|
+
}, props));
|
|
389
|
+
};
|
|
304
390
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
children: PropTypes.node,
|
|
312
|
-
focusable: PropTypes.bool
|
|
391
|
+
IconButton.propTypes = propTypes$m;
|
|
392
|
+
IconButton.defaultProps = defaultProps$m;
|
|
393
|
+
|
|
394
|
+
var _excluded$6 = ["className"];
|
|
395
|
+
var propTypes$l = {
|
|
396
|
+
className: PropTypes.string
|
|
313
397
|
};
|
|
314
|
-
var defaultProps$
|
|
315
|
-
|
|
316
|
-
url: null,
|
|
317
|
-
className: null,
|
|
318
|
-
buttonClassName: null,
|
|
319
|
-
onShare: null,
|
|
320
|
-
children: null,
|
|
321
|
-
focusable: false
|
|
398
|
+
var defaultProps$l = {
|
|
399
|
+
className: null
|
|
322
400
|
};
|
|
323
401
|
|
|
324
|
-
var
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
buttonClassName = _ref.buttonClassName,
|
|
329
|
-
onShare = _ref.onShare,
|
|
330
|
-
children = _ref.children,
|
|
331
|
-
focusable = _ref.focusable;
|
|
402
|
+
var CloseButton = function CloseButton(_ref) {
|
|
403
|
+
var className = _ref.className,
|
|
404
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
405
|
+
|
|
332
406
|
var intl = useIntl();
|
|
407
|
+
return /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
408
|
+
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
409
|
+
label: intl.formatMessage({
|
|
410
|
+
id: "dj/p/q",
|
|
411
|
+
defaultMessage: [{
|
|
412
|
+
"type": 0,
|
|
413
|
+
"value": "Close"
|
|
414
|
+
}]
|
|
415
|
+
}),
|
|
416
|
+
icon: /*#__PURE__*/React.createElement("svg", {
|
|
417
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
418
|
+
width: "10",
|
|
419
|
+
height: "16",
|
|
420
|
+
viewBox: "0 0 10 16",
|
|
421
|
+
fill: "currentColor"
|
|
422
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
423
|
+
points: "9.95 4.11 8.89 3.05 5 6.94 1.11 3.05 0.05 4.11 3.94 8 0.05 11.89 1.11 12.95 5 9.06 8.89 12.95 9.95 11.89 6.06 8 9.95 4.11"
|
|
424
|
+
}))
|
|
425
|
+
}, props));
|
|
426
|
+
};
|
|
333
427
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
storyShareModalOpened = _useState2[0],
|
|
337
|
-
setStoryShareModalOpened = _useState2[1];
|
|
428
|
+
CloseButton.propTypes = propTypes$l;
|
|
429
|
+
CloseButton.defaultProps = defaultProps$l;
|
|
338
430
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
431
|
+
var _excluded$5 = ["className"];
|
|
432
|
+
var propTypes$k = {
|
|
433
|
+
className: PropTypes.string
|
|
434
|
+
};
|
|
435
|
+
var defaultProps$k = {
|
|
436
|
+
className: null
|
|
437
|
+
};
|
|
346
438
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
357
|
-
className: classNames([_defineProperty({}, buttonClassName, buttonClassName !== null)]),
|
|
358
|
-
onClick: onShareIconClick,
|
|
359
|
-
title: intl.formatMessage({
|
|
360
|
-
id: "7tw6U2",
|
|
439
|
+
var MenuButton = function MenuButton(_ref) {
|
|
440
|
+
var className = _ref.className,
|
|
441
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
442
|
+
|
|
443
|
+
var intl = useIntl();
|
|
444
|
+
return /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
445
|
+
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
446
|
+
label: intl.formatMessage({
|
|
447
|
+
id: "F/gl4b",
|
|
361
448
|
defaultMessage: [{
|
|
362
449
|
"type": 0,
|
|
363
|
-
"value": "
|
|
450
|
+
"value": "Menu"
|
|
364
451
|
}]
|
|
365
452
|
}),
|
|
366
|
-
"
|
|
453
|
+
iconPosition: "right",
|
|
454
|
+
icon: /*#__PURE__*/React.createElement("svg", {
|
|
455
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
456
|
+
width: "10",
|
|
457
|
+
height: "16",
|
|
458
|
+
viewBox: "0 0 10 16",
|
|
459
|
+
fill: "currentColor"
|
|
460
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
461
|
+
width: "10",
|
|
462
|
+
height: "16"
|
|
463
|
+
}))
|
|
464
|
+
}, props));
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
MenuButton.propTypes = propTypes$k;
|
|
468
|
+
MenuButton.defaultProps = defaultProps$k;
|
|
469
|
+
|
|
470
|
+
var _excluded$4 = ["className"];
|
|
471
|
+
var propTypes$j = {
|
|
472
|
+
className: PropTypes.string
|
|
473
|
+
};
|
|
474
|
+
var defaultProps$j = {
|
|
475
|
+
className: null
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
var ShareButton = function ShareButton(_ref) {
|
|
479
|
+
var className = _ref.className,
|
|
480
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
481
|
+
|
|
482
|
+
var intl = useIntl();
|
|
483
|
+
return /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
484
|
+
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
485
|
+
label: intl.formatMessage({
|
|
367
486
|
id: "7tw6U2",
|
|
368
487
|
defaultMessage: [{
|
|
369
488
|
"type": 0,
|
|
370
489
|
"value": "Share"
|
|
371
490
|
}]
|
|
372
491
|
}),
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
492
|
+
iconPosition: "left",
|
|
493
|
+
icon: /*#__PURE__*/React.createElement("svg", {
|
|
494
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
495
|
+
width: "10",
|
|
496
|
+
height: "16",
|
|
497
|
+
viewBox: "0 0 10 16",
|
|
498
|
+
fill: "currentColor"
|
|
499
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
500
|
+
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"
|
|
501
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
502
|
+
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"
|
|
503
|
+
}))
|
|
504
|
+
}, props));
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
ShareButton.propTypes = propTypes$j;
|
|
508
|
+
ShareButton.defaultProps = defaultProps$j;
|
|
509
|
+
|
|
510
|
+
var styles$e = {"container":"micromag-viewer-buttons-toggle-button-container","normal":"micromag-viewer-buttons-toggle-button-normal","toggled":"micromag-viewer-buttons-toggle-button-toggled"};
|
|
511
|
+
|
|
512
|
+
var propTypes$i = {
|
|
513
|
+
className: PropTypes.string,
|
|
514
|
+
toggled: PropTypes.number,
|
|
515
|
+
button: PropTypes.node,
|
|
516
|
+
toggledButton: PropTypes.node,
|
|
517
|
+
toggledButtonClassName: PropTypes.string
|
|
518
|
+
};
|
|
519
|
+
var defaultProps$i = {
|
|
520
|
+
className: null,
|
|
521
|
+
toggled: 0,
|
|
522
|
+
button: null,
|
|
523
|
+
toggledButton: null,
|
|
524
|
+
toggledButtonClassName: null
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
var ToggleButton = function ToggleButton(_ref) {
|
|
528
|
+
var className = _ref.className,
|
|
529
|
+
toggled = _ref.toggled,
|
|
530
|
+
button = _ref.button,
|
|
531
|
+
toggledButton = _ref.toggledButton,
|
|
532
|
+
toggledButtonClassName = _ref.toggledButtonClassName;
|
|
533
|
+
if (button === null) return false;
|
|
534
|
+
|
|
535
|
+
var getToggleButtonStyles = function getToggleButtonStyles(t) {
|
|
536
|
+
return {
|
|
537
|
+
transform: "translateY(".concat(t * -100, "%)")
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
542
|
+
className: classNames([styles$e.container, _defineProperty({}, className, className !== null)])
|
|
543
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
544
|
+
className: styles$e.normal,
|
|
545
|
+
style: getToggleButtonStyles(toggled)
|
|
546
|
+
}, button), /*#__PURE__*/React.createElement("div", {
|
|
547
|
+
className: classNames([styles$e.toggled, _defineProperty({}, toggledButtonClassName, toggledButtonClassName !== null)]),
|
|
548
|
+
style: getToggleButtonStyles(toggled - 1)
|
|
549
|
+
}, toggledButton));
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
ToggleButton.propTypes = propTypes$i;
|
|
553
|
+
ToggleButton.defaultProps = defaultProps$i;
|
|
554
|
+
|
|
555
|
+
var styles$d = {"backdrop":"micromag-viewer-menus-menu-container-backdrop","container":"micromag-viewer-menus-menu-container-container","heightContainer":"micromag-viewer-menus-menu-container-heightContainer","inner":"micromag-viewer-menus-menu-container-inner"};
|
|
556
|
+
|
|
557
|
+
var propTypes$h = {
|
|
558
|
+
className: PropTypes.string,
|
|
559
|
+
transitionProgress: PropTypes.number,
|
|
560
|
+
children: PropTypes.node
|
|
561
|
+
};
|
|
562
|
+
var defaultProps$h = {
|
|
563
|
+
className: null,
|
|
564
|
+
transitionProgress: 0,
|
|
565
|
+
children: null
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
var ViewerMenuContainer = function ViewerMenuContainer(_ref) {
|
|
569
|
+
var className = _ref.className,
|
|
570
|
+
transitionProgress = _ref.transitionProgress,
|
|
571
|
+
children = _ref.children;
|
|
572
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
573
|
+
className: classNames([styles$d.container, _defineProperty({}, className, className !== null)]),
|
|
574
|
+
style: {
|
|
575
|
+
pointerEvents: 'none'
|
|
576
|
+
}
|
|
577
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
578
|
+
className: styles$d.heightContainer,
|
|
579
|
+
style: {
|
|
580
|
+
height: "".concat(transitionProgress * 100, "%"),
|
|
581
|
+
pointerEvents: transitionProgress < 0.25 ? 'none' : 'auto',
|
|
582
|
+
zIndex: Math.round(1 + transitionProgress)
|
|
583
|
+
}
|
|
584
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
585
|
+
className: styles$d.inner,
|
|
586
|
+
style: {
|
|
587
|
+
paddingTop: "".concat(3 * transitionProgress, "rem"),
|
|
588
|
+
paddingBottom: "".concat(0.5 * transitionProgress, "rem")
|
|
589
|
+
}
|
|
590
|
+
}, children)), /*#__PURE__*/React.createElement("div", {
|
|
591
|
+
className: styles$d.backdrop,
|
|
592
|
+
style: {
|
|
593
|
+
opacity: easings.easeOutQuint(transitionProgress)
|
|
594
|
+
}
|
|
381
595
|
}));
|
|
382
596
|
};
|
|
383
597
|
|
|
384
|
-
|
|
385
|
-
|
|
598
|
+
ViewerMenuContainer.propTypes = propTypes$h;
|
|
599
|
+
ViewerMenuContainer.defaultProps = defaultProps$h;
|
|
386
600
|
|
|
387
|
-
var styles$
|
|
601
|
+
var styles$c = {"button":"micromag-viewer-menus-menu-dot-button","progress":"micromag-viewer-menus-menu-dot-progress","container":"micromag-viewer-menus-menu-dot-container","vertical":"micromag-viewer-menus-menu-dot-vertical","dot":"micromag-viewer-menus-menu-dot-dot","subDot":"micromag-viewer-menus-menu-dot-subDot","dots":"micromag-viewer-menus-menu-dot-dots","outlineBounce":"micromag-viewer-menus-menu-dot-outlineBounce"};
|
|
388
602
|
|
|
389
|
-
var propTypes$
|
|
603
|
+
var propTypes$g = {
|
|
390
604
|
current: PropTypes.bool,
|
|
391
605
|
active: PropTypes.bool,
|
|
392
606
|
colors: PropTypes.shape({
|
|
@@ -399,7 +613,7 @@ var propTypes$f = {
|
|
|
399
613
|
onClick: PropTypes.func,
|
|
400
614
|
className: PropTypes.string
|
|
401
615
|
};
|
|
402
|
-
var defaultProps$
|
|
616
|
+
var defaultProps$g = {
|
|
403
617
|
current: false,
|
|
404
618
|
active: false,
|
|
405
619
|
colors: null,
|
|
@@ -421,130 +635,67 @@ var ViewerMenuDot = function ViewerMenuDot(_ref) {
|
|
|
421
635
|
vertical = _ref.vertical,
|
|
422
636
|
onClick = _ref.onClick,
|
|
423
637
|
className = _ref.className;
|
|
424
|
-
var currentTime = 0;
|
|
425
|
-
var duration = 1;
|
|
426
|
-
var playing = true;
|
|
427
638
|
|
|
428
639
|
var _ref2 = colors || {},
|
|
429
640
|
_ref2$primary = _ref2.primary,
|
|
430
641
|
primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary,
|
|
431
642
|
_ref2$secondary = _ref2.secondary,
|
|
432
|
-
secondary = _ref2$secondary === void 0 ? 'rgba(
|
|
433
|
-
|
|
643
|
+
secondary = _ref2$secondary === void 0 ? 'rgba(255, 255, 255, 0.25)' : _ref2$secondary;
|
|
434
644
|
|
|
435
645
|
var _useSpring = useSpring(function () {
|
|
436
646
|
return {
|
|
437
|
-
|
|
647
|
+
scaleX: 0,
|
|
438
648
|
config: {
|
|
439
|
-
|
|
649
|
+
tension: 200,
|
|
650
|
+
friction: 30
|
|
440
651
|
}
|
|
441
652
|
};
|
|
442
653
|
}),
|
|
443
|
-
_useSpring2 = _slicedToArray(_useSpring, 2)
|
|
444
|
-
_useSpring2[0]
|
|
445
|
-
|
|
654
|
+
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
655
|
+
dotSpringStyles = _useSpring2[0],
|
|
656
|
+
setDotSpringProps = _useSpring2[1];
|
|
446
657
|
|
|
447
658
|
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
|
-
}
|
|
462
|
-
});
|
|
463
|
-
}, [playing, duration, currentTime, setSpringProps]);
|
|
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
|
-
}
|
|
659
|
+
var activeRatio = active ? 1 : 0;
|
|
660
|
+
var ratio = count > 1 && current ? (subIndex + 1) / count : activeRatio;
|
|
661
|
+
var scaleX = ratio;
|
|
662
|
+
setDotSpringProps.start({
|
|
663
|
+
scaleX: scaleX,
|
|
664
|
+
immediate: !current
|
|
473
665
|
});
|
|
474
|
-
}
|
|
475
|
-
className: styles$a.dot,
|
|
476
|
-
style: {
|
|
477
|
-
backgroundColor: active ? primary : secondary
|
|
478
|
-
}
|
|
479
|
-
});
|
|
666
|
+
}, [active, current, subIndex, count, setDotSpringProps]);
|
|
480
667
|
return /*#__PURE__*/React.createElement("li", {
|
|
481
|
-
className: classNames([styles$
|
|
668
|
+
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
669
|
"aria-hidden": "true"
|
|
483
670
|
}, /*#__PURE__*/React.createElement("button", {
|
|
484
671
|
type: "button",
|
|
485
|
-
className: styles$
|
|
672
|
+
className: styles$c.button,
|
|
486
673
|
onClick: onClick,
|
|
487
674
|
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
|
-
}));
|
|
675
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
676
|
+
className: styles$c.dot,
|
|
677
|
+
style: {
|
|
678
|
+
backgroundColor: secondary
|
|
679
|
+
}
|
|
680
|
+
}, /*#__PURE__*/React.createElement(animated.div, {
|
|
681
|
+
className: styles$c.progress,
|
|
682
|
+
style: _objectSpread(_objectSpread({}, dotSpringStyles), {}, {
|
|
683
|
+
backgroundColor: primary
|
|
684
|
+
})
|
|
685
|
+
}))));
|
|
532
686
|
};
|
|
533
687
|
|
|
534
|
-
|
|
535
|
-
|
|
688
|
+
ViewerMenuDot.propTypes = propTypes$g;
|
|
689
|
+
ViewerMenuDot.defaultProps = defaultProps$g;
|
|
536
690
|
|
|
537
|
-
var styles$
|
|
691
|
+
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
692
|
|
|
539
|
-
var
|
|
693
|
+
var _excluded$3 = ["direction", "items", "onClickDot", "onClickScreensMenu", "colors", "closeable", "withItemClick", "withoutScreensMenu", "onClose", "className"];
|
|
694
|
+
var propTypes$f = {
|
|
540
695
|
direction: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
541
|
-
withShadow: PropTypes.bool,
|
|
542
|
-
title: PropTypes.string,
|
|
543
696
|
items: PropTypes$1.menuItems,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
onClickItem: PropTypes.func,
|
|
547
|
-
onClickMenu: PropTypes.func,
|
|
697
|
+
onClickDot: PropTypes.func,
|
|
698
|
+
onClickScreensMenu: PropTypes.func,
|
|
548
699
|
colors: PropTypes.shape({
|
|
549
700
|
primary: PropTypes.string,
|
|
550
701
|
secondary: PropTypes.string
|
|
@@ -552,46 +703,36 @@ var propTypes$d = {
|
|
|
552
703
|
closeable: PropTypes.bool,
|
|
553
704
|
withItemClick: PropTypes.bool,
|
|
554
705
|
withoutScreensMenu: PropTypes.bool,
|
|
555
|
-
withoutShareMenu: PropTypes.bool,
|
|
556
706
|
onClose: PropTypes.func,
|
|
557
707
|
className: PropTypes.string
|
|
558
708
|
};
|
|
559
|
-
var defaultProps$
|
|
709
|
+
var defaultProps$f = {
|
|
560
710
|
direction: 'horizontal',
|
|
561
|
-
withShadow: false,
|
|
562
|
-
title: null,
|
|
563
711
|
items: [],
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
onClickItem: null,
|
|
567
|
-
onClickMenu: null,
|
|
712
|
+
onClickDot: null,
|
|
713
|
+
onClickScreensMenu: null,
|
|
568
714
|
colors: null,
|
|
569
715
|
closeable: false,
|
|
570
716
|
withItemClick: false,
|
|
571
717
|
withoutScreensMenu: false,
|
|
572
|
-
withoutShareMenu: false,
|
|
573
718
|
onClose: null,
|
|
574
719
|
className: null
|
|
575
720
|
};
|
|
576
721
|
|
|
577
722
|
var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
578
|
-
var
|
|
723
|
+
var _ref5;
|
|
579
724
|
|
|
580
725
|
var direction = _ref.direction,
|
|
581
|
-
withShadow = _ref.withShadow,
|
|
582
|
-
title = _ref.title,
|
|
583
726
|
items = _ref.items,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
onClickItem = _ref.onClickItem,
|
|
587
|
-
onClickMenu = _ref.onClickMenu,
|
|
727
|
+
onClickDot = _ref.onClickDot,
|
|
728
|
+
onClickScreensMenu = _ref.onClickScreensMenu,
|
|
588
729
|
colors = _ref.colors,
|
|
589
730
|
closeable = _ref.closeable,
|
|
590
731
|
withItemClick = _ref.withItemClick,
|
|
591
732
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
592
|
-
withoutShareMenu = _ref.withoutShareMenu,
|
|
593
733
|
onClose = _ref.onClose,
|
|
594
|
-
className = _ref.className
|
|
734
|
+
className = _ref.className,
|
|
735
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
595
736
|
|
|
596
737
|
var _ref2 = colors || {},
|
|
597
738
|
_ref2$primary = _ref2.primary,
|
|
@@ -603,8 +744,12 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
603
744
|
current = _ref3$current === void 0 ? false : _ref3$current;
|
|
604
745
|
return current;
|
|
605
746
|
});
|
|
747
|
+
|
|
748
|
+
var _ref4 = props || {},
|
|
749
|
+
style = _ref4.style;
|
|
750
|
+
|
|
606
751
|
return /*#__PURE__*/React.createElement("nav", {
|
|
607
|
-
className: classNames([styles$
|
|
752
|
+
className: classNames([styles$b.container, (_ref5 = {}, _defineProperty(_ref5, className, className !== null), _defineProperty(_ref5, styles$b.vertical, direction === 'vertical'), _ref5)]),
|
|
608
753
|
"aria-label": intl.formatMessage({
|
|
609
754
|
id: "bLYuuN",
|
|
610
755
|
defaultMessage: [{
|
|
@@ -626,17 +771,18 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
626
771
|
}, {
|
|
627
772
|
current: currentIndex + 1,
|
|
628
773
|
total: items.length
|
|
629
|
-
})
|
|
774
|
+
}),
|
|
775
|
+
style: style
|
|
630
776
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
631
|
-
className: styles$
|
|
777
|
+
className: styles$b.items
|
|
632
778
|
}, items.map(function (item, index) {
|
|
633
|
-
var
|
|
634
|
-
|
|
635
|
-
current =
|
|
636
|
-
|
|
637
|
-
count =
|
|
638
|
-
|
|
639
|
-
subIndex =
|
|
779
|
+
var _ref6 = item || {},
|
|
780
|
+
_ref6$current = _ref6.current,
|
|
781
|
+
current = _ref6$current === void 0 ? false : _ref6$current,
|
|
782
|
+
_ref6$count = _ref6.count,
|
|
783
|
+
count = _ref6$count === void 0 ? 1 : _ref6$count,
|
|
784
|
+
_ref6$subIndex = _ref6.subIndex,
|
|
785
|
+
subIndex = _ref6$subIndex === void 0 ? 0 : _ref6$subIndex;
|
|
640
786
|
|
|
641
787
|
return /*#__PURE__*/React.createElement(ViewerMenuDot, {
|
|
642
788
|
key: "item-".concat(index + 1),
|
|
@@ -646,56 +792,22 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
646
792
|
count: count,
|
|
647
793
|
subIndex: subIndex,
|
|
648
794
|
onClick: function onClick() {
|
|
649
|
-
if ((withItemClick || withoutScreensMenu) &&
|
|
650
|
-
|
|
651
|
-
} else if (!withItemClick &&
|
|
652
|
-
|
|
795
|
+
if ((withItemClick || withoutScreensMenu) && onClickDot !== null) {
|
|
796
|
+
onClickDot(item);
|
|
797
|
+
} else if (!withItemClick && onClickScreensMenu !== null) {
|
|
798
|
+
onClickScreensMenu();
|
|
653
799
|
}
|
|
654
800
|
},
|
|
655
801
|
vertical: direction === 'vertical'
|
|
656
802
|
});
|
|
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,
|
|
803
|
+
}), closeable ? /*#__PURE__*/React.createElement("li", {
|
|
804
|
+
className: styles$b.closeButton,
|
|
693
805
|
style: {
|
|
694
806
|
color: primary
|
|
695
807
|
}
|
|
696
808
|
}, /*#__PURE__*/React.createElement("button", {
|
|
697
809
|
type: "button",
|
|
698
|
-
className: styles$
|
|
810
|
+
className: styles$b.closeButton,
|
|
699
811
|
onClick: onClose,
|
|
700
812
|
title: intl.formatMessage({
|
|
701
813
|
id: "dj/p/q",
|
|
@@ -716,13 +828,13 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
716
828
|
}))) : null));
|
|
717
829
|
};
|
|
718
830
|
|
|
719
|
-
ViewerMenuDots.propTypes = propTypes$
|
|
720
|
-
ViewerMenuDots.defaultProps = defaultProps$
|
|
831
|
+
ViewerMenuDots.propTypes = propTypes$f;
|
|
832
|
+
ViewerMenuDots.defaultProps = defaultProps$f;
|
|
721
833
|
|
|
722
|
-
var propTypes$
|
|
834
|
+
var propTypes$e = {
|
|
723
835
|
className: PropTypes.string
|
|
724
836
|
};
|
|
725
|
-
var defaultProps$
|
|
837
|
+
var defaultProps$e = {
|
|
726
838
|
className: null
|
|
727
839
|
};
|
|
728
840
|
|
|
@@ -730,50 +842,143 @@ var StackIcon = function StackIcon(_ref) {
|
|
|
730
842
|
var className = _ref.className;
|
|
731
843
|
return /*#__PURE__*/React.createElement("svg", {
|
|
732
844
|
xmlns: "http://www.w3.org/2000/svg",
|
|
733
|
-
width: "
|
|
734
|
-
height: "
|
|
735
|
-
viewBox: "0 0
|
|
845
|
+
width: "11.5",
|
|
846
|
+
height: "17.5",
|
|
847
|
+
viewBox: "0 0 11.5 17.5",
|
|
736
848
|
className: classNames([_defineProperty({}, className, className !== null)])
|
|
737
|
-
}, /*#__PURE__*/React.createElement("
|
|
738
|
-
|
|
849
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
850
|
+
width: "10",
|
|
851
|
+
height: "16"
|
|
852
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
853
|
+
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
854
|
}));
|
|
740
855
|
};
|
|
741
856
|
|
|
742
|
-
StackIcon.propTypes = propTypes$
|
|
743
|
-
StackIcon.defaultProps = defaultProps$
|
|
857
|
+
StackIcon.propTypes = propTypes$e;
|
|
858
|
+
StackIcon.defaultProps = defaultProps$e;
|
|
744
859
|
|
|
745
|
-
var styles$
|
|
860
|
+
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
861
|
|
|
747
|
-
var propTypes$
|
|
748
|
-
|
|
862
|
+
var propTypes$d = {
|
|
863
|
+
className: PropTypes.string,
|
|
864
|
+
item: PropTypes$1.menuItem,
|
|
865
|
+
index: PropTypes.number,
|
|
866
|
+
onClick: PropTypes.func,
|
|
749
867
|
screenSize: PropTypes$1.screenSize,
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
868
|
+
focusable: PropTypes.bool
|
|
869
|
+
};
|
|
870
|
+
var defaultProps$d = {
|
|
871
|
+
className: null,
|
|
872
|
+
item: PropTypes$1.menuItem,
|
|
873
|
+
index: 0,
|
|
874
|
+
onClick: null,
|
|
875
|
+
screenSize: null,
|
|
876
|
+
focusable: true
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
var ViewerMenuScreen = function ViewerMenuScreen(_ref) {
|
|
880
|
+
var _ref4;
|
|
881
|
+
|
|
882
|
+
var className = _ref.className,
|
|
883
|
+
item = _ref.item,
|
|
884
|
+
index = _ref.index,
|
|
885
|
+
_onClick = _ref.onClick,
|
|
886
|
+
screenSize = _ref.screenSize,
|
|
887
|
+
focusable = _ref.focusable;
|
|
888
|
+
var intl = useIntl();
|
|
889
|
+
|
|
890
|
+
var _ref2 = item || {},
|
|
891
|
+
_ref2$current = _ref2.current,
|
|
892
|
+
current = _ref2$current === void 0 ? false : _ref2$current,
|
|
893
|
+
screen = _ref2.screen,
|
|
894
|
+
_ref2$count = _ref2.count,
|
|
895
|
+
count = _ref2$count === void 0 ? 1 : _ref2$count;
|
|
896
|
+
|
|
897
|
+
var _ref3 = screenSize || {},
|
|
898
|
+
screenWidth = _ref3.width,
|
|
899
|
+
screenHeight = _ref3.height;
|
|
900
|
+
|
|
901
|
+
var screenAriaLabel = "".concat(intl.formatMessage({
|
|
902
|
+
id: "LkVfwW",
|
|
903
|
+
defaultMessage: [{
|
|
904
|
+
"type": 0,
|
|
905
|
+
"value": "Screen "
|
|
906
|
+
}, {
|
|
907
|
+
"type": 1,
|
|
908
|
+
"value": "index"
|
|
909
|
+
}]
|
|
910
|
+
}, {
|
|
911
|
+
index: index + 1
|
|
912
|
+
})).concat(current ? " ".concat(intl.formatMessage({
|
|
913
|
+
id: "vmrJ8U",
|
|
914
|
+
defaultMessage: [{
|
|
915
|
+
"type": 0,
|
|
916
|
+
"value": "(current screen)"
|
|
917
|
+
}]
|
|
918
|
+
})) : '');
|
|
919
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
920
|
+
className: classNames([styles$a.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$a.isCurrent, current), _ref4)])
|
|
921
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
922
|
+
type: "button",
|
|
923
|
+
className: styles$a.button,
|
|
924
|
+
onClick: function onClick() {
|
|
925
|
+
if (_onClick !== null) {
|
|
926
|
+
_onClick(item);
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
"aria-label": screenAriaLabel,
|
|
930
|
+
tabIndex: focusable ? '0' : '-1'
|
|
931
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
932
|
+
className: styles$a.inner
|
|
933
|
+
}, count > 1 ? /*#__PURE__*/React.createElement("div", {
|
|
934
|
+
className: styles$a.subScreenBadge
|
|
935
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
936
|
+
className: styles$a.subScreenCount
|
|
937
|
+
}, count), /*#__PURE__*/React.createElement(StackIcon, {
|
|
938
|
+
className: styles$a.subScreenIcon
|
|
939
|
+
})) : null, screenWidth > 0 && screenHeight > 0 ? /*#__PURE__*/React.createElement(ScreenPreview, {
|
|
940
|
+
className: styles$a.screen,
|
|
941
|
+
screenWidth: screenWidth,
|
|
942
|
+
screenHeight: screenHeight,
|
|
943
|
+
screen: screen,
|
|
944
|
+
focusable: focusable,
|
|
945
|
+
active: focusable,
|
|
946
|
+
withSize: true
|
|
947
|
+
}) : null));
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
ViewerMenuScreen.propTypes = propTypes$d;
|
|
951
|
+
ViewerMenuScreen.defaultProps = defaultProps$d;
|
|
952
|
+
|
|
953
|
+
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","screen":"micromag-viewer-menus-menu-preview-screen","loading":"micromag-viewer-menus-menu-preview-loading","fillPulse":"micromag-viewer-menus-menu-preview-fillPulse"};
|
|
954
|
+
|
|
955
|
+
var propTypes$c = {
|
|
956
|
+
viewerTheme: PropTypes$1.viewerTheme,
|
|
957
|
+
screenSize: PropTypes$1.screenSize,
|
|
958
|
+
menuWidth: PropTypes.number,
|
|
959
|
+
items: PropTypes$1.menuItems,
|
|
960
|
+
focusable: PropTypes.bool,
|
|
961
|
+
onClickScreen: PropTypes.func,
|
|
757
962
|
maxThumbsWidth: PropTypes.number,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
963
|
+
// @todo to reimplement:
|
|
964
|
+
// shouldLoad: PropTypes.bool,
|
|
965
|
+
// toggleFullscreen: PropTypes.func,
|
|
966
|
+
// fullscreenActive: PropTypes.bool,
|
|
967
|
+
// fullscreenEnabled: PropTypes.bool,
|
|
761
968
|
className: PropTypes.string
|
|
762
969
|
};
|
|
763
|
-
var defaultProps$
|
|
970
|
+
var defaultProps$c = {
|
|
764
971
|
viewerTheme: null,
|
|
765
972
|
screenSize: null,
|
|
766
973
|
menuWidth: null,
|
|
767
|
-
title: null,
|
|
768
974
|
items: [],
|
|
769
975
|
focusable: true,
|
|
770
|
-
shouldLoad: true,
|
|
771
|
-
|
|
772
|
-
onClose: null,
|
|
976
|
+
// shouldLoad: true,
|
|
977
|
+
onClickScreen: null,
|
|
773
978
|
maxThumbsWidth: 140,
|
|
774
|
-
toggleFullscreen: null,
|
|
775
|
-
fullscreenActive: false,
|
|
776
|
-
fullscreenEnabled: false,
|
|
979
|
+
// toggleFullscreen: null,
|
|
980
|
+
// fullscreenActive: false,
|
|
981
|
+
// fullscreenEnabled: false,
|
|
777
982
|
className: null
|
|
778
983
|
};
|
|
779
984
|
|
|
@@ -781,259 +986,298 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
781
986
|
var viewerTheme = _ref.viewerTheme,
|
|
782
987
|
screenSize = _ref.screenSize,
|
|
783
988
|
menuWidth = _ref.menuWidth,
|
|
784
|
-
title = _ref.title,
|
|
785
989
|
items = _ref.items,
|
|
786
990
|
focusable = _ref.focusable,
|
|
787
|
-
|
|
788
|
-
onClose = _ref.onClose,
|
|
991
|
+
onClickScreen = _ref.onClickScreen,
|
|
789
992
|
maxThumbsWidth = _ref.maxThumbsWidth,
|
|
790
|
-
toggleFullscreen = _ref.toggleFullscreen,
|
|
791
|
-
fullscreenActive = _ref.fullscreenActive,
|
|
792
|
-
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
793
993
|
className = _ref.className;
|
|
794
|
-
var intl = useIntl();
|
|
795
|
-
|
|
796
|
-
var _ref2 = screenSize || {},
|
|
797
|
-
screenWidth = _ref2.width,
|
|
798
|
-
screenHeight = _ref2.height;
|
|
799
994
|
|
|
800
995
|
var _useDimensionObserver = useDimensionObserver(),
|
|
801
|
-
|
|
996
|
+
containerRef = _useDimensionObserver.ref,
|
|
802
997
|
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
803
|
-
|
|
998
|
+
contentWidth = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
804
999
|
|
|
805
|
-
var
|
|
806
|
-
containerRef = _useDimensionObserver3.ref,
|
|
807
|
-
_useDimensionObserver4 = _useDimensionObserver3.width,
|
|
808
|
-
contentWidth = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
1000
|
+
var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // @note cool, should be in recipes
|
|
809
1001
|
|
|
810
|
-
var
|
|
1002
|
+
var _ref2 = viewerTheme || {},
|
|
1003
|
+
_ref2$background = _ref2.background,
|
|
1004
|
+
background = _ref2$background === void 0 ? null : _ref2$background;
|
|
1005
|
+
_ref2.logo;
|
|
811
1006
|
|
|
812
|
-
var _ref3 =
|
|
813
|
-
_ref3$
|
|
814
|
-
|
|
815
|
-
_ref3$
|
|
816
|
-
|
|
817
|
-
_ref3$textStyles = _ref3.textStyles,
|
|
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;
|
|
825
|
-
|
|
826
|
-
var _ref5 = colors || {},
|
|
827
|
-
_ref5$primary = _ref5.primary,
|
|
828
|
-
brandPrimaryColor = _ref5$primary === void 0 ? null : _ref5$primary,
|
|
829
|
-
_ref5$secondary = _ref5.secondary,
|
|
830
|
-
brandSecondaryColor = _ref5$secondary === void 0 ? null : _ref5$secondary;
|
|
831
|
-
|
|
832
|
-
var _ref6 = background || {},
|
|
833
|
-
_ref6$color = _ref6.color,
|
|
834
|
-
brandBackgroundColor = _ref6$color === void 0 ? null : _ref6$color,
|
|
835
|
-
_ref6$image = _ref6.image,
|
|
836
|
-
image = _ref6$image === void 0 ? null : _ref6$image;
|
|
837
|
-
|
|
838
|
-
var _ref7 = image || {},
|
|
839
|
-
_ref7$url = _ref7.url,
|
|
840
|
-
brandImageUrl = _ref7$url === void 0 ? null : _ref7$url;
|
|
841
|
-
|
|
842
|
-
var borderPrimaryColorStyle = getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
843
|
-
var colorSecondaryColorStyle = getStyleFromColor(brandSecondaryColor, 'color');
|
|
844
|
-
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
1007
|
+
var _ref3 = background || {},
|
|
1008
|
+
_ref3$color = _ref3.color,
|
|
1009
|
+
brandBackgroundColor = _ref3$color === void 0 ? null : _ref3$color,
|
|
1010
|
+
_ref3$image = _ref3.image,
|
|
1011
|
+
image = _ref3$image === void 0 ? null : _ref3$image;
|
|
845
1012
|
|
|
846
|
-
var
|
|
847
|
-
|
|
848
|
-
|
|
1013
|
+
var _ref4 = image || {},
|
|
1014
|
+
_ref4$url = _ref4.url,
|
|
1015
|
+
brandImageUrl = _ref4$url === void 0 ? null : _ref4$url;
|
|
849
1016
|
|
|
1017
|
+
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
850
1018
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
851
1019
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
852
|
-
} : null;
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1020
|
+
} : null; // @todo reimplement the brand logo
|
|
1021
|
+
// const { url: brandLogoUrl = null } = brandLogo || {};
|
|
1022
|
+
// @todo optimize all of this the proper way
|
|
1023
|
+
// const finalItems = useMemo(
|
|
1024
|
+
// () => (!focusable ? items.map((s, i) => (i > 6 ? { screenId: s.screenId } : s)) : items),
|
|
1025
|
+
// [items, focusable],
|
|
1026
|
+
// );
|
|
859
1027
|
|
|
860
|
-
|
|
861
|
-
|
|
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
|
-
var finalItems = useMemo(function () {
|
|
882
|
-
return !focusable ? items.slice(0, 3) : items;
|
|
883
|
-
}, [items, focusable]);
|
|
884
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
885
|
-
className: classNames([styles$7.container, _defineProperty({}, className, className !== null)]),
|
|
1028
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1029
|
+
className: classNames([styles$9.container, _defineProperty({}, className, className !== null)]),
|
|
886
1030
|
style: _objectSpread(_objectSpread(_objectSpread({}, backgroundColorStyle), brandImageStyle), {}, {
|
|
887
1031
|
width: menuWidth
|
|
888
1032
|
}),
|
|
889
1033
|
"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,
|
|
1034
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1035
|
+
className: styles$9.content,
|
|
947
1036
|
ref: containerRef
|
|
948
1037
|
}, /*#__PURE__*/React.createElement(Scroll, {
|
|
949
|
-
className: styles$
|
|
950
|
-
onScrolledBottom: onScrolledBottom,
|
|
951
|
-
onScrolledNotBottom: onScrolledNotBottom
|
|
1038
|
+
className: styles$9.scroll
|
|
952
1039
|
}, /*#__PURE__*/React.createElement("nav", {
|
|
953
|
-
className: styles$
|
|
1040
|
+
className: styles$9.nav
|
|
954
1041
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
955
|
-
className: styles$
|
|
956
|
-
},
|
|
957
|
-
var
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
screen =
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
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
|
-
})) : '');
|
|
1042
|
+
className: styles$9.items
|
|
1043
|
+
}, items.map(function (item, index) {
|
|
1044
|
+
var _ref6 = item || {},
|
|
1045
|
+
screenId = _ref6.screenId,
|
|
1046
|
+
_ref6$screen = _ref6.screen,
|
|
1047
|
+
screen = _ref6$screen === void 0 ? null : _ref6$screen;
|
|
1048
|
+
|
|
1049
|
+
var itemStyles = {
|
|
1050
|
+
width: "".concat(100 / thumbsPerLine, "%")
|
|
1051
|
+
};
|
|
981
1052
|
return /*#__PURE__*/React.createElement("li", {
|
|
982
|
-
className: classNames([styles$7.item, _defineProperty({}, styles$7.active, current)]),
|
|
983
1053
|
key: "item-".concat(screenId),
|
|
1054
|
+
className: styles$9.item,
|
|
1055
|
+
style: itemStyles
|
|
1056
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1057
|
+
className: styles$9.screen
|
|
1058
|
+
}, screen === null ? /*#__PURE__*/React.createElement("svg", {
|
|
1059
|
+
className: styles$9.loading,
|
|
1060
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1061
|
+
width: "10",
|
|
1062
|
+
height: "16",
|
|
1063
|
+
viewBox: "0 0 10 16",
|
|
984
1064
|
style: {
|
|
985
|
-
|
|
1065
|
+
animationDelay: "".concat(index * -50, "ms")
|
|
986
1066
|
}
|
|
987
|
-
}, /*#__PURE__*/React.createElement("
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
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'
|
|
1024
|
-
}));
|
|
1067
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
1068
|
+
width: "10",
|
|
1069
|
+
height: "16"
|
|
1070
|
+
})) : /*#__PURE__*/React.createElement(ViewerMenuScreen, {
|
|
1071
|
+
item: item,
|
|
1072
|
+
index: index,
|
|
1073
|
+
screenSize: screenSize,
|
|
1074
|
+
onClick: onClickScreen,
|
|
1075
|
+
focusable: focusable
|
|
1076
|
+
})));
|
|
1025
1077
|
}))))));
|
|
1026
1078
|
};
|
|
1027
1079
|
|
|
1028
|
-
ViewerMenuPreview.propTypes = propTypes$
|
|
1029
|
-
ViewerMenuPreview.defaultProps = defaultProps$
|
|
1080
|
+
ViewerMenuPreview.propTypes = propTypes$c;
|
|
1081
|
+
ViewerMenuPreview.defaultProps = defaultProps$c;
|
|
1082
|
+
|
|
1083
|
+
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"};
|
|
1084
|
+
|
|
1085
|
+
var propTypes$b = {
|
|
1086
|
+
screen: PropTypes$1.item,
|
|
1087
|
+
title: PropTypes.string,
|
|
1088
|
+
url: PropTypes.string,
|
|
1089
|
+
description: PropTypes.string,
|
|
1090
|
+
className: PropTypes.string
|
|
1091
|
+
};
|
|
1092
|
+
var defaultProps$b = {
|
|
1093
|
+
screen: null,
|
|
1094
|
+
title: null,
|
|
1095
|
+
url: null,
|
|
1096
|
+
description: null,
|
|
1097
|
+
className: null
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
var MicromagPreview = function MicromagPreview(_ref) {
|
|
1101
|
+
var screen = _ref.screen,
|
|
1102
|
+
title = _ref.title,
|
|
1103
|
+
url = _ref.url,
|
|
1104
|
+
description = _ref.description,
|
|
1105
|
+
className = _ref.className;
|
|
1106
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1107
|
+
className: classNames([styles$8.container, _defineProperty({}, className, className)])
|
|
1108
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1109
|
+
className: styles$8.cover
|
|
1110
|
+
}, /*#__PURE__*/React.createElement(ScreenPreview, {
|
|
1111
|
+
screen: screen,
|
|
1112
|
+
width: 100,
|
|
1113
|
+
height: 150,
|
|
1114
|
+
withSize: true
|
|
1115
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1116
|
+
className: styles$8.info
|
|
1117
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
1118
|
+
className: styles$8.title
|
|
1119
|
+
}, title), url ? /*#__PURE__*/React.createElement("div", {
|
|
1120
|
+
className: styles$8.url
|
|
1121
|
+
}, url) : null, /*#__PURE__*/React.createElement("p", null, description)));
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
MicromagPreview.propTypes = propTypes$b;
|
|
1125
|
+
MicromagPreview.defaultProps = defaultProps$b;
|
|
1030
1126
|
|
|
1031
|
-
var styles$
|
|
1127
|
+
var styles$7 = {"scroll":"micromag-viewer-menus-menu-share-scroll","container":"micromag-viewer-menus-menu-share-container","disabled":"micromag-viewer-menus-menu-share-disabled","button":"micromag-viewer-menus-menu-share-button","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","content":"micromag-viewer-menus-menu-share-content"};
|
|
1032
1128
|
|
|
1033
1129
|
var propTypes$a = {
|
|
1130
|
+
viewerTheme: PropTypes$1.viewerTheme,
|
|
1131
|
+
menuWidth: PropTypes.number,
|
|
1132
|
+
title: PropTypes.string,
|
|
1133
|
+
description: PropTypes.string,
|
|
1134
|
+
items: PropTypes$1.menuItems,
|
|
1135
|
+
focusable: PropTypes.bool,
|
|
1136
|
+
// shouldLoad: PropTypes.bool, // @todo still needed? to re-implement?
|
|
1137
|
+
currentScreenIndex: PropTypes.number,
|
|
1138
|
+
shareUrl: PropTypes.string,
|
|
1139
|
+
onShare: PropTypes.func,
|
|
1140
|
+
className: PropTypes.string
|
|
1141
|
+
};
|
|
1142
|
+
var defaultProps$a = {
|
|
1143
|
+
viewerTheme: null,
|
|
1144
|
+
menuWidth: null,
|
|
1145
|
+
title: null,
|
|
1146
|
+
description: null,
|
|
1147
|
+
items: [],
|
|
1148
|
+
focusable: true,
|
|
1149
|
+
currentScreenIndex: 0,
|
|
1150
|
+
shareUrl: null,
|
|
1151
|
+
onShare: null,
|
|
1152
|
+
className: null
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
var ViewerMenuShare = function ViewerMenuShare(_ref) {
|
|
1156
|
+
var viewerTheme = _ref.viewerTheme,
|
|
1157
|
+
menuWidth = _ref.menuWidth,
|
|
1158
|
+
title = _ref.title,
|
|
1159
|
+
description = _ref.description,
|
|
1160
|
+
items = _ref.items,
|
|
1161
|
+
focusable = _ref.focusable,
|
|
1162
|
+
currentScreenIndex = _ref.currentScreenIndex,
|
|
1163
|
+
shareUrl = _ref.shareUrl,
|
|
1164
|
+
onShare = _ref.onShare,
|
|
1165
|
+
className = _ref.className;
|
|
1166
|
+
|
|
1167
|
+
// Viewer theme
|
|
1168
|
+
var _ref2 = viewerTheme || {},
|
|
1169
|
+
_ref2$background = _ref2.background,
|
|
1170
|
+
background = _ref2$background === void 0 ? null : _ref2$background;
|
|
1171
|
+
|
|
1172
|
+
var _ref3 = background || {},
|
|
1173
|
+
_ref3$color = _ref3.color,
|
|
1174
|
+
brandBackgroundColor = _ref3$color === void 0 ? null : _ref3$color,
|
|
1175
|
+
_ref3$image = _ref3.image,
|
|
1176
|
+
image = _ref3$image === void 0 ? null : _ref3$image;
|
|
1177
|
+
|
|
1178
|
+
var _ref4 = image || {},
|
|
1179
|
+
_ref4$url = _ref4.url,
|
|
1180
|
+
brandImageUrl = _ref4$url === void 0 ? null : _ref4$url;
|
|
1181
|
+
|
|
1182
|
+
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
1183
|
+
var brandImageStyle = brandImageUrl !== null ? {
|
|
1184
|
+
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
1185
|
+
} : null;
|
|
1186
|
+
var coverScreen = useMemo(function () {
|
|
1187
|
+
var _ref5 = items[0] || {},
|
|
1188
|
+
_ref5$screen = _ref5.screen,
|
|
1189
|
+
screen = _ref5$screen === void 0 ? null : _ref5$screen;
|
|
1190
|
+
|
|
1191
|
+
return screen;
|
|
1192
|
+
}, [items]);
|
|
1193
|
+
var currentScreen = useMemo(function () {
|
|
1194
|
+
var found = items.find(function (item) {
|
|
1195
|
+
var _ref6 = item || {},
|
|
1196
|
+
_ref6$current = _ref6.current,
|
|
1197
|
+
current = _ref6$current === void 0 ? false : _ref6$current;
|
|
1198
|
+
|
|
1199
|
+
return current;
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
var _ref7 = found || {},
|
|
1203
|
+
_ref7$screen = _ref7.screen,
|
|
1204
|
+
screen = _ref7$screen === void 0 ? null : _ref7$screen;
|
|
1205
|
+
|
|
1206
|
+
return screen;
|
|
1207
|
+
}, [items, currentScreenIndex, focusable]);
|
|
1208
|
+
|
|
1209
|
+
var _useState = useState(false),
|
|
1210
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1211
|
+
shareCurrentScreen = _useState2[0],
|
|
1212
|
+
setShareCurrentScreen = _useState2[1];
|
|
1213
|
+
|
|
1214
|
+
var onShareModeChange = useCallback(function () {
|
|
1215
|
+
setShareCurrentScreen(function (value) {
|
|
1216
|
+
return !value;
|
|
1217
|
+
});
|
|
1218
|
+
}, [setShareCurrentScreen]);
|
|
1219
|
+
|
|
1220
|
+
var _useState3 = useState(shareUrl),
|
|
1221
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1222
|
+
finalShareUrl = _useState4[0],
|
|
1223
|
+
setFinalShareUrl = _useState4[1];
|
|
1224
|
+
|
|
1225
|
+
useEffect(function () {
|
|
1226
|
+
setFinalShareUrl(shareCurrentScreen && currentScreenIndex !== 0 ? "".concat(shareUrl, "/").concat(currentScreenIndex) : shareUrl);
|
|
1227
|
+
}, [shareCurrentScreen, currentScreenIndex, setFinalShareUrl]);
|
|
1228
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1229
|
+
className: classNames([styles$7.container, _defineProperty({}, className, className !== null)]),
|
|
1230
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, backgroundColorStyle), brandImageStyle), {}, {
|
|
1231
|
+
width: menuWidth
|
|
1232
|
+
}),
|
|
1233
|
+
"aria-hidden": focusable ? null : 'true'
|
|
1234
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1235
|
+
className: styles$7.content
|
|
1236
|
+
}, /*#__PURE__*/React.createElement(Scroll, {
|
|
1237
|
+
className: styles$7.scroll
|
|
1238
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1239
|
+
className: styles$7.header
|
|
1240
|
+
}, /*#__PURE__*/React.createElement(MicromagPreview, {
|
|
1241
|
+
className: styles$7.preview,
|
|
1242
|
+
screen: shareCurrentScreen ? currentScreen : coverScreen,
|
|
1243
|
+
title: title,
|
|
1244
|
+
url: finalShareUrl,
|
|
1245
|
+
description: description
|
|
1246
|
+
}), currentScreenIndex !== 0 ? /*#__PURE__*/React.createElement("div", {
|
|
1247
|
+
className: styles$7.mode
|
|
1248
|
+
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
|
|
1249
|
+
type: "checkbox",
|
|
1250
|
+
name: "currentScreen",
|
|
1251
|
+
value: "currentScreen",
|
|
1252
|
+
onChange: onShareModeChange,
|
|
1253
|
+
checked: shareCurrentScreen
|
|
1254
|
+
}), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1255
|
+
id: "xuPbeq",
|
|
1256
|
+
defaultMessage: [{
|
|
1257
|
+
"type": 0,
|
|
1258
|
+
"value": "Start from the current screen"
|
|
1259
|
+
}]
|
|
1260
|
+
}))) : null), /*#__PURE__*/React.createElement(ShareOptions, {
|
|
1261
|
+
className: styles$7.options,
|
|
1262
|
+
itemClassName: styles$7.optionItem,
|
|
1263
|
+
buttonClassName: styles$7.optionButton,
|
|
1264
|
+
title: title,
|
|
1265
|
+
url: finalShareUrl,
|
|
1266
|
+
focusable: focusable,
|
|
1267
|
+
onShare: onShare,
|
|
1268
|
+
theme: viewerTheme,
|
|
1269
|
+
shareCurrentScreen: shareCurrentScreen
|
|
1270
|
+
}))));
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
ViewerMenuShare.propTypes = propTypes$a;
|
|
1274
|
+
ViewerMenuShare.defaultProps = defaultProps$a;
|
|
1275
|
+
|
|
1276
|
+
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","withoutGestures":"micromag-viewer-withoutGestures","fadeMenu":"micromag-viewer-fadeMenu","withShadow":"micromag-viewer-withShadow","isOpened":"micromag-viewer-isOpened","menuItem":"micromag-viewer-menuItem","menuItemScreens":"micromag-viewer-menuItemScreens","menuButton":"micromag-viewer-menuButton","slidingButton":"micromag-viewer-slidingButton","screensMenuButtonToggled":"micromag-viewer-screensMenuButtonToggled","isHidden":"micromag-viewer-isHidden","navButton":"micromag-viewer-navButton","previous":"micromag-viewer-previous","next":"micromag-viewer-next","screen":"micromag-viewer-screen","current":"micromag-viewer-current","playbackControls":"micromag-viewer-playbackControls","arrowHint":"micromag-viewer-arrowHint","webView":"micromag-viewer-webView"};
|
|
1277
|
+
|
|
1278
|
+
var propTypes$9 = {
|
|
1034
1279
|
story: PropTypes$1.story.isRequired,
|
|
1035
1280
|
currentScreenIndex: PropTypes.number,
|
|
1036
|
-
opened: PropTypes.bool,
|
|
1037
1281
|
toggleFullscreen: PropTypes.func,
|
|
1038
1282
|
fullscreenActive: PropTypes.bool,
|
|
1039
1283
|
fullscreenEnabled: PropTypes.bool,
|
|
@@ -1047,9 +1291,7 @@ var propTypes$a = {
|
|
|
1047
1291
|
withDotItemClick: PropTypes.bool,
|
|
1048
1292
|
withoutScreensMenu: PropTypes.bool,
|
|
1049
1293
|
withoutShareMenu: PropTypes.bool,
|
|
1050
|
-
|
|
1051
|
-
onRequestClose: PropTypes.func,
|
|
1052
|
-
onClickItem: PropTypes.func,
|
|
1294
|
+
onClickScreen: PropTypes.func,
|
|
1053
1295
|
onClickMenu: PropTypes.func,
|
|
1054
1296
|
onClickCloseViewer: PropTypes.func,
|
|
1055
1297
|
refDots: PropTypes.shape({
|
|
@@ -1057,9 +1299,8 @@ var propTypes$a = {
|
|
|
1057
1299
|
|
|
1058
1300
|
})
|
|
1059
1301
|
};
|
|
1060
|
-
var defaultProps$
|
|
1302
|
+
var defaultProps$9 = {
|
|
1061
1303
|
currentScreenIndex: 0,
|
|
1062
|
-
opened: false,
|
|
1063
1304
|
toggleFullscreen: null,
|
|
1064
1305
|
fullscreenActive: false,
|
|
1065
1306
|
fullscreenEnabled: false,
|
|
@@ -1073,18 +1314,17 @@ var defaultProps$a = {
|
|
|
1073
1314
|
withDotItemClick: false,
|
|
1074
1315
|
withoutScreensMenu: false,
|
|
1075
1316
|
withoutShareMenu: false,
|
|
1076
|
-
|
|
1077
|
-
onRequestClose: null,
|
|
1078
|
-
onClickItem: null,
|
|
1317
|
+
onClickScreen: null,
|
|
1079
1318
|
onClickMenu: null,
|
|
1080
1319
|
onClickCloseViewer: null,
|
|
1081
1320
|
refDots: null
|
|
1082
1321
|
};
|
|
1083
1322
|
|
|
1084
1323
|
var ViewerMenu = function ViewerMenu(_ref) {
|
|
1324
|
+
var _ref11;
|
|
1325
|
+
|
|
1085
1326
|
var story = _ref.story,
|
|
1086
1327
|
currentScreenIndex = _ref.currentScreenIndex,
|
|
1087
|
-
opened = _ref.opened,
|
|
1088
1328
|
toggleFullscreen = _ref.toggleFullscreen,
|
|
1089
1329
|
fullscreenActive = _ref.fullscreenActive,
|
|
1090
1330
|
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
@@ -1098,23 +1338,42 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1098
1338
|
withDotItemClick = _ref.withDotItemClick,
|
|
1099
1339
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1100
1340
|
withoutShareMenu = _ref.withoutShareMenu,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
customOnClickMenu = _ref.onClickMenu,
|
|
1105
|
-
onClickCloseViewer = _ref.onClickCloseViewer,
|
|
1341
|
+
customOnClickScreen = _ref.onClickScreen;
|
|
1342
|
+
_ref.onClickMenu;
|
|
1343
|
+
var onClickCloseViewer = _ref.onClickCloseViewer,
|
|
1106
1344
|
refDots = _ref.refDots;
|
|
1107
1345
|
var _story$components = story.components,
|
|
1108
1346
|
screens = _story$components === void 0 ? [] : _story$components,
|
|
1109
1347
|
_story$title = story.title,
|
|
1110
|
-
title = _story$title === void 0 ? null : _story$title
|
|
1348
|
+
title = _story$title === void 0 ? null : _story$title,
|
|
1349
|
+
_story$metadata = story.metadata,
|
|
1350
|
+
metadata = _story$metadata === void 0 ? null : _story$metadata;
|
|
1351
|
+
|
|
1352
|
+
var _ref2 = metadata || {},
|
|
1353
|
+
_ref2$description = _ref2.description,
|
|
1354
|
+
description = _ref2$description === void 0 ? null : _ref2$description;
|
|
1355
|
+
|
|
1111
1356
|
var currentScreen = screens !== null ? screens[currentScreenIndex] || null : null;
|
|
1112
1357
|
|
|
1113
|
-
var
|
|
1114
|
-
|
|
1115
|
-
screenId =
|
|
1116
|
-
|
|
1117
|
-
screenType =
|
|
1358
|
+
var _ref3 = currentScreen || {},
|
|
1359
|
+
_ref3$id = _ref3.id,
|
|
1360
|
+
screenId = _ref3$id === void 0 ? null : _ref3$id,
|
|
1361
|
+
_ref3$type = _ref3.type,
|
|
1362
|
+
screenType = _ref3$type === void 0 ? null : _ref3$type;
|
|
1363
|
+
|
|
1364
|
+
var _ref4 = viewerTheme || {},
|
|
1365
|
+
_ref4$menuTheme = _ref4.menuTheme,
|
|
1366
|
+
menuTheme = _ref4$menuTheme === void 0 ? null : _ref4$menuTheme;
|
|
1367
|
+
|
|
1368
|
+
var _useState = useState(false),
|
|
1369
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1370
|
+
menuOpened = _useState2[0],
|
|
1371
|
+
setMenuOpened = _useState2[1];
|
|
1372
|
+
|
|
1373
|
+
var _useState3 = useState(false),
|
|
1374
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1375
|
+
shareOpened = _useState4[0],
|
|
1376
|
+
setShareOpened = _useState4[1];
|
|
1118
1377
|
|
|
1119
1378
|
var items = useMemo(function () {
|
|
1120
1379
|
return screens.map(function (it) {
|
|
@@ -1135,9 +1394,9 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1135
1394
|
count: children.length + 1 || 1,
|
|
1136
1395
|
subIndex: subIndex || 0
|
|
1137
1396
|
};
|
|
1138
|
-
}).filter(function (
|
|
1139
|
-
var
|
|
1140
|
-
visible =
|
|
1397
|
+
}).filter(function (_ref5) {
|
|
1398
|
+
var _ref5$visible = _ref5.visible,
|
|
1399
|
+
visible = _ref5$visible === void 0 ? true : _ref5$visible;
|
|
1141
1400
|
return visible;
|
|
1142
1401
|
});
|
|
1143
1402
|
}, [screens, screenId]);
|
|
@@ -1152,225 +1411,268 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1152
1411
|
}
|
|
1153
1412
|
}, [trackEvent, screenId, currentScreenIndex, screenType]);
|
|
1154
1413
|
var shareUrl = useMemo(function () {
|
|
1155
|
-
|
|
1156
|
-
|
|
1414
|
+
// @todo validate this
|
|
1415
|
+
// const base =
|
|
1416
|
+
// typeof window !== 'undefined' ? window.location.origin.replace(/\/+$/, '') : '';
|
|
1417
|
+
// const path = shareBasePath !== null ? `${base}${shareBasePath}` : base;
|
|
1418
|
+
var base = typeof window !== 'undefined' ? window.location.host : '';
|
|
1419
|
+
var path = shareBasePath !== null ? "".concat(base).concat(shareBasePath) : base;
|
|
1157
1420
|
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);
|
|
1421
|
+
}, [shareBasePath]); // @note possible to extract some of that logic
|
|
1173
1422
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1423
|
+
var onOpenMenu = useCallback(function () {
|
|
1424
|
+
setMenuOpened(true);
|
|
1425
|
+
setShareOpened(false);
|
|
1426
|
+
trackScreenEvent('viewer_menu', 'open_screens_menu');
|
|
1427
|
+
}, [setMenuOpened, setShareOpened, trackScreenEvent]);
|
|
1428
|
+
var onCloseMenu = useCallback(function () {
|
|
1429
|
+
setMenuOpened(false);
|
|
1430
|
+
setShareOpened(false);
|
|
1431
|
+
trackScreenEvent('viewer_menu', 'close_screens_menu');
|
|
1432
|
+
}, [setMenuOpened, setShareOpened, trackScreenEvent]);
|
|
1433
|
+
var onOpenShare = useCallback(function () {
|
|
1434
|
+
setShareOpened(true);
|
|
1435
|
+
setMenuOpened(false);
|
|
1436
|
+
trackScreenEvent('viewer_menu', 'open_share_menu');
|
|
1437
|
+
}, [setShareOpened, setMenuOpened, trackScreenEvent]);
|
|
1438
|
+
var onCloseShare = useCallback(function () {
|
|
1439
|
+
setShareOpened(false);
|
|
1440
|
+
setMenuOpened(false);
|
|
1441
|
+
trackScreenEvent('viewer_menu', 'close_share_menu');
|
|
1442
|
+
}, [setShareOpened, setMenuOpened, trackScreenEvent]);
|
|
1443
|
+
var onClickScreen = useCallback(function (screen) {
|
|
1444
|
+
setMenuOpened(false);
|
|
1445
|
+
|
|
1446
|
+
if (customOnClickScreen !== null) {
|
|
1447
|
+
customOnClickScreen(screen);
|
|
1448
|
+
}
|
|
1177
1449
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1450
|
+
var index = items.findIndex(function (_ref6) {
|
|
1451
|
+
var id = _ref6.id;
|
|
1452
|
+
return id === screenId;
|
|
1181
1453
|
});
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
var
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1454
|
+
trackScreenEvent('viewer_menu', 'click_screen_change', "Screen ".concat(index + 1));
|
|
1455
|
+
}, [customOnClickScreen, setMenuOpened, items, screenId, trackScreenEvent]);
|
|
1456
|
+
var onShare = useCallback(function (type) {
|
|
1457
|
+
// @todo display something to say thanks for sharing?
|
|
1458
|
+
trackScreenEvent('viewer_menu', 'shared_story', type);
|
|
1459
|
+
}, [trackScreenEvent]);
|
|
1460
|
+
var computeShareProgress = useCallback(function (_ref7) {
|
|
1461
|
+
var active = _ref7.active,
|
|
1462
|
+
_ref7$direction = _slicedToArray(_ref7.direction, 2),
|
|
1463
|
+
dy = _ref7$direction[1],
|
|
1464
|
+
_ref7$movement = _slicedToArray(_ref7.movement, 2),
|
|
1465
|
+
my = _ref7$movement[1],
|
|
1466
|
+
_ref7$velocity = _slicedToArray(_ref7.velocity, 2),
|
|
1467
|
+
vy = _ref7$velocity[1];
|
|
1468
|
+
|
|
1469
|
+
var progress = Math.max(0, my) / (window.innerHeight * 0.8);
|
|
1470
|
+
var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
|
|
1471
|
+
|
|
1472
|
+
if (!active) {
|
|
1473
|
+
if (reachedThreshold) onOpenShare();
|
|
1474
|
+
return reachedThreshold ? 1 : 0;
|
|
1475
|
+
}
|
|
1188
1476
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
my =
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
return;
|
|
1477
|
+
return progress;
|
|
1478
|
+
}, [onOpenShare]);
|
|
1479
|
+
var computeShareProgressClose = useCallback(function (_ref8) {
|
|
1480
|
+
var active = _ref8.active,
|
|
1481
|
+
_ref8$direction = _slicedToArray(_ref8.direction, 2),
|
|
1482
|
+
dy = _ref8$direction[1],
|
|
1483
|
+
_ref8$movement = _slicedToArray(_ref8.movement, 2),
|
|
1484
|
+
my = _ref8$movement[1],
|
|
1485
|
+
_ref8$velocity = _slicedToArray(_ref8.velocity, 2),
|
|
1486
|
+
vy = _ref8$velocity[1];
|
|
1487
|
+
|
|
1488
|
+
var progress = Math.max(0, my) / (window.innerHeight * 0.8);
|
|
1489
|
+
var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
|
|
1490
|
+
|
|
1491
|
+
if (!active) {
|
|
1492
|
+
if (reachedThreshold) onCloseShare();
|
|
1493
|
+
return reachedThreshold ? 0 : 1;
|
|
1207
1494
|
}
|
|
1208
1495
|
|
|
1209
|
-
|
|
1496
|
+
return 1 - progress;
|
|
1497
|
+
}, [onCloseShare]);
|
|
1210
1498
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1499
|
+
var _useDragProgress = useDragProgress({
|
|
1500
|
+
progress: shareOpened ? 1 : 0,
|
|
1501
|
+
computeProgress: shareOpened ? computeShareProgressClose : computeShareProgress,
|
|
1502
|
+
springParams: {
|
|
1503
|
+
config: {
|
|
1504
|
+
tension: 300,
|
|
1505
|
+
friction: 30
|
|
1215
1506
|
}
|
|
1216
1507
|
}
|
|
1508
|
+
}),
|
|
1509
|
+
bindShareDrag = _useDragProgress.bind,
|
|
1510
|
+
shareOpenedProgress = _useDragProgress.progress;
|
|
1217
1511
|
|
|
1218
|
-
|
|
1512
|
+
var computeMenuProgress = useCallback(function (_ref9) {
|
|
1513
|
+
var active = _ref9.active,
|
|
1514
|
+
_ref9$direction = _slicedToArray(_ref9.direction, 2),
|
|
1515
|
+
dy = _ref9$direction[1],
|
|
1516
|
+
_ref9$movement = _slicedToArray(_ref9.movement, 2),
|
|
1517
|
+
my = _ref9$movement[1],
|
|
1518
|
+
_ref9$velocity = _slicedToArray(_ref9.velocity, 2),
|
|
1519
|
+
vy = _ref9$velocity[1];
|
|
1219
1520
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
refOpened.current = menuNowOpened;
|
|
1223
|
-
setMenuSpring.start({
|
|
1224
|
-
y: menuNowOpened ? 1 : 0
|
|
1225
|
-
});
|
|
1521
|
+
var progress = Math.max(0, my) / (window.innerHeight * 0.8);
|
|
1522
|
+
var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
|
|
1226
1523
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
onRequestClose();
|
|
1231
|
-
}
|
|
1232
|
-
} else {
|
|
1233
|
-
setMenuSpring.start({
|
|
1234
|
-
y: yProgress
|
|
1235
|
-
});
|
|
1524
|
+
if (!active) {
|
|
1525
|
+
if (reachedThreshold) onOpenMenu();
|
|
1526
|
+
return reachedThreshold ? 1 : 0;
|
|
1236
1527
|
}
|
|
1237
|
-
}, {
|
|
1238
|
-
axis: 'y',
|
|
1239
|
-
filterTaps: true
|
|
1240
|
-
}); // handle preview menu item click
|
|
1241
1528
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1529
|
+
return progress;
|
|
1530
|
+
}, [onOpenMenu]);
|
|
1531
|
+
var computeMenuProgressClose = useCallback(function (_ref10) {
|
|
1532
|
+
var active = _ref10.active,
|
|
1533
|
+
_ref10$direction = _slicedToArray(_ref10.direction, 2),
|
|
1534
|
+
dy = _ref10$direction[1],
|
|
1535
|
+
_ref10$movement = _slicedToArray(_ref10.movement, 2),
|
|
1536
|
+
my = _ref10$movement[1],
|
|
1537
|
+
_ref10$velocity = _slicedToArray(_ref10.velocity, 2),
|
|
1538
|
+
vy = _ref10$velocity[1];
|
|
1539
|
+
|
|
1540
|
+
var progress = Math.max(0, my) / (window.innerHeight * 0.8);
|
|
1541
|
+
var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
|
|
1542
|
+
|
|
1543
|
+
if (!active) {
|
|
1544
|
+
if (reachedThreshold) onCloseMenu();
|
|
1545
|
+
return reachedThreshold ? 0 : 1;
|
|
1245
1546
|
}
|
|
1246
1547
|
|
|
1247
|
-
|
|
1248
|
-
}, [
|
|
1249
|
-
var onClickItem = useCallback(function (item) {
|
|
1250
|
-
if (customOnClickItem !== null) {
|
|
1251
|
-
customOnClickItem(item);
|
|
1252
|
-
}
|
|
1548
|
+
return 1 - progress;
|
|
1549
|
+
}, [onCloseMenu]);
|
|
1253
1550
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
onRequestClose();
|
|
1551
|
+
var _useDragProgress2 = useDragProgress({
|
|
1552
|
+
progress: menuOpened ? 1 : 0,
|
|
1553
|
+
computeProgress: menuOpened ? computeMenuProgressClose : computeMenuProgress,
|
|
1554
|
+
springParams: {
|
|
1555
|
+
config: {
|
|
1556
|
+
tension: 300,
|
|
1557
|
+
friction: 30
|
|
1558
|
+
}
|
|
1263
1559
|
}
|
|
1560
|
+
}),
|
|
1561
|
+
bindMenuDrag = _useDragProgress2.bind,
|
|
1562
|
+
menuOpenedProgress = _useDragProgress2.progress;
|
|
1264
1563
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1564
|
+
var keyboardShortcuts = useMemo(function () {
|
|
1565
|
+
return {
|
|
1566
|
+
m: function m() {
|
|
1567
|
+
return !menuOpened ? onOpenMenu() : onCloseMenu();
|
|
1568
|
+
},
|
|
1569
|
+
escape: function escape() {
|
|
1570
|
+
return onCloseMenu();
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
}, [menuOpened, onOpenMenu, onCloseMenu]);
|
|
1574
|
+
useKeyboardShortcuts(keyboardShortcuts); // should be zero if either screens menu or share menu is opened
|
|
1275
1575
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1576
|
+
var dotsOpacity = Math.min(1, Math.max(0, 1 - (menuOpenedProgress + shareOpenedProgress)));
|
|
1577
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1578
|
+
className: classNames([styles$6.menuNavContainer, (_ref11 = {}, _defineProperty(_ref11, styles$6.withShadow, withShadow), _defineProperty(_ref11, styles$6.isOpened, menuOpened || shareOpened), _ref11)]),
|
|
1278
1579
|
ref: refDots,
|
|
1279
1580
|
style: {
|
|
1280
1581
|
width: menuWidth
|
|
1281
1582
|
}
|
|
1282
|
-
},
|
|
1583
|
+
}, /*#__PURE__*/React.createElement("nav", {
|
|
1584
|
+
className: styles$6.menuTopContainer
|
|
1585
|
+
}, !withoutShareMenu ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1586
|
+
className: classNames([styles$6.menuItem, styles$6.menuShare])
|
|
1587
|
+
}, bindShareDrag()), /*#__PURE__*/React.createElement(ToggleButton, {
|
|
1588
|
+
className: styles$6.slidingButton,
|
|
1589
|
+
button: /*#__PURE__*/React.createElement(ShareButton, {
|
|
1590
|
+
className: styles$6.menuButton,
|
|
1591
|
+
onClick: onOpenShare,
|
|
1592
|
+
theme: menuTheme,
|
|
1593
|
+
iconPosition: "left"
|
|
1594
|
+
}),
|
|
1595
|
+
toggledButton: /*#__PURE__*/React.createElement(CloseButton, {
|
|
1596
|
+
className: styles$6.menuButton,
|
|
1597
|
+
onClick: onCloseShare,
|
|
1598
|
+
theme: menuTheme,
|
|
1599
|
+
iconPosition: "left"
|
|
1600
|
+
}),
|
|
1601
|
+
toggled: shareOpenedProgress
|
|
1602
|
+
})) : null, !withoutScreensMenu ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1603
|
+
className: classNames([styles$6.menuItem, styles$6.menuItemScreens])
|
|
1604
|
+
}, bindMenuDrag()), /*#__PURE__*/React.createElement(ToggleButton, {
|
|
1605
|
+
className: styles$6.slidingButton,
|
|
1606
|
+
button: /*#__PURE__*/React.createElement(MenuButton, {
|
|
1607
|
+
className: styles$6.menuButton,
|
|
1608
|
+
onClick: onOpenMenu,
|
|
1609
|
+
theme: menuTheme
|
|
1610
|
+
}),
|
|
1611
|
+
toggledButton: /*#__PURE__*/React.createElement(CloseButton, {
|
|
1612
|
+
className: styles$6.menuButton,
|
|
1613
|
+
onClick: onCloseMenu,
|
|
1614
|
+
theme: menuTheme,
|
|
1615
|
+
iconPosition: "right"
|
|
1616
|
+
}),
|
|
1617
|
+
toggled: menuOpenedProgress,
|
|
1618
|
+
toggledButtonClassName: styles$6.screensMenuButtonToggled
|
|
1619
|
+
})) : null), /*#__PURE__*/React.createElement(ViewerMenuDots, Object.assign({}, menuTheme, {
|
|
1283
1620
|
direction: "horizontal",
|
|
1284
|
-
withShadow: withShadow,
|
|
1285
1621
|
items: items,
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
onShare: onClickShare,
|
|
1289
|
-
onClickItem: onClickItem,
|
|
1290
|
-
onClickMenu: onClickMenu,
|
|
1622
|
+
onClickDot: onClickScreen,
|
|
1623
|
+
onClickScreensMenu: onOpenMenu,
|
|
1291
1624
|
closeable: closeable,
|
|
1292
1625
|
withItemClick: withDotItemClick,
|
|
1293
1626
|
withoutScreensMenu: withoutScreensMenu,
|
|
1294
1627
|
withoutShareMenu: withoutShareMenu,
|
|
1295
1628
|
onClose: onClickCloseViewer,
|
|
1296
|
-
className: styles$6.
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1629
|
+
className: styles$6.dots,
|
|
1630
|
+
style: {
|
|
1631
|
+
opacity: Math.pow(dotsOpacity, 5),
|
|
1632
|
+
// @note this is like a "quint" easing, meaning it'll go towards 1 slowly first and then fast as it approaches 1
|
|
1633
|
+
pointerEvents: dotsOpacity < 1 ? 'none' : 'auto'
|
|
1634
|
+
}
|
|
1635
|
+
}))), /*#__PURE__*/React.createElement(ViewerMenuContainer, {
|
|
1636
|
+
className: styles$6.menuContainerShare,
|
|
1637
|
+
transitionProgress: shareOpenedProgress
|
|
1638
|
+
}, shareOpenedProgress > 0 ? /*#__PURE__*/React.createElement(ViewerMenuShare, {
|
|
1639
|
+
viewerTheme: viewerTheme,
|
|
1640
|
+
className: styles$6.menuShare,
|
|
1641
|
+
title: title,
|
|
1642
|
+
description: description,
|
|
1643
|
+
menuWidth: menuWidth,
|
|
1644
|
+
focusable: shareOpened,
|
|
1645
|
+
items: items,
|
|
1646
|
+
currentScreenIndex: currentScreenIndex,
|
|
1647
|
+
shareUrl: shareUrl,
|
|
1648
|
+
onShare: onShare,
|
|
1649
|
+
onClose: onCloseShare
|
|
1650
|
+
}) : null), /*#__PURE__*/React.createElement(ViewerMenuContainer, {
|
|
1651
|
+
className: styles$6.menuContainerScreens,
|
|
1652
|
+
transitionProgress: menuOpenedProgress
|
|
1653
|
+
}, menuOpenedProgress > 0 ? /*#__PURE__*/React.createElement(ViewerMenuPreview, {
|
|
1302
1654
|
viewerTheme: viewerTheme,
|
|
1303
1655
|
className: styles$6.menuPreview,
|
|
1304
1656
|
screenSize: screenSize,
|
|
1305
1657
|
menuWidth: menuWidth,
|
|
1306
|
-
focusable: opened,
|
|
1307
1658
|
items: items,
|
|
1308
|
-
|
|
1309
|
-
|
|
1659
|
+
currentScreenIndex: currentScreenIndex,
|
|
1660
|
+
shareUrl: shareUrl,
|
|
1661
|
+
onShare: onShare,
|
|
1662
|
+
onClickScreen: onClickScreen,
|
|
1663
|
+
onClose: onCloseMenu,
|
|
1310
1664
|
toggleFullscreen: toggleFullscreen,
|
|
1311
1665
|
fullscreenActive: fullscreenActive,
|
|
1312
1666
|
fullscreenEnabled: fullscreenEnabled
|
|
1313
|
-
})));
|
|
1667
|
+
}) : null));
|
|
1314
1668
|
};
|
|
1315
1669
|
|
|
1316
|
-
ViewerMenu.propTypes = propTypes$
|
|
1317
|
-
ViewerMenu.defaultProps = defaultProps$
|
|
1670
|
+
ViewerMenu.propTypes = propTypes$9;
|
|
1671
|
+
ViewerMenu.defaultProps = defaultProps$9;
|
|
1318
1672
|
|
|
1319
|
-
var styles$5 = {"container":"micromag-viewer-
|
|
1320
|
-
|
|
1321
|
-
var propTypes$9 = {
|
|
1322
|
-
color: PropTypes.string,
|
|
1323
|
-
className: PropTypes.string
|
|
1324
|
-
};
|
|
1325
|
-
var defaultProps$9 = {
|
|
1326
|
-
color: 'currentColor',
|
|
1327
|
-
className: null
|
|
1328
|
-
};
|
|
1329
|
-
|
|
1330
|
-
var HandIcon = function HandIcon(_ref) {
|
|
1331
|
-
var color = _ref.color,
|
|
1332
|
-
className = _ref.className;
|
|
1333
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
1334
|
-
className: className,
|
|
1335
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1336
|
-
viewBox: "0 0 367.24 482.87"
|
|
1337
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
1338
|
-
d: "M488.84,255.91a44.68,44.68,0,0,0-19.15,4.3A44.77,44.77,0,0,0,406,226.49a44.75,44.75,0,0,0-62.67-32.66V105.4a44.81,44.81,0,1,0-89.61,0V265.17l-1.15-2.7a44.78,44.78,0,1,0-82.84,34.06l64.87,157.76.34.73a156.29,156.29,0,0,0,141.42,88.44c86.7,0,157.24-70.53,157.24-157.26V300.7a44.82,44.82,0,0,0-44.78-44.79ZM507.46,386.2c0,72.3-58.78,131.1-131.07,131.1a130.29,130.29,0,0,1-117.73-73.36L193.93,286.61a18.64,18.64,0,1,1,34.53-14.07L279.91,394V105.4a18.64,18.64,0,1,1,37.28,0v196a13.08,13.08,0,0,0,26.16,0V234.56a18.64,18.64,0,0,1,37.27,0v89.95a13.07,13.07,0,1,0,26.13,0V266.86a18.64,18.64,0,1,1,37.28,0v80.71h0s0,.08,0,.11a13.08,13.08,0,0,0,26.15,0v-47a18.63,18.63,0,1,1,37.26,0v85.5Z",
|
|
1339
|
-
transform: "translate(-166.38 -60.59)",
|
|
1340
|
-
fill: color,
|
|
1341
|
-
fillRule: "evenodd"
|
|
1342
|
-
}));
|
|
1343
|
-
};
|
|
1344
|
-
|
|
1345
|
-
HandIcon.propTypes = propTypes$9;
|
|
1346
|
-
HandIcon.defaultProps = defaultProps$9;
|
|
1673
|
+
var styles$5 = {"container":"micromag-viewer-screen-container","navigationHint":"micromag-viewer-screen-navigationHint"};
|
|
1347
1674
|
|
|
1348
1675
|
var propTypes$8 = {
|
|
1349
|
-
className: PropTypes.string
|
|
1350
|
-
};
|
|
1351
|
-
var defaultProps$8 = {
|
|
1352
|
-
className: null
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
var HandTap = function HandTap(_ref) {
|
|
1356
|
-
var className = _ref.className;
|
|
1357
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1358
|
-
className: classNames([styles$5.container, _defineProperty({}, className, className !== null)])
|
|
1359
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1360
|
-
className: styles$5.inner
|
|
1361
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1362
|
-
className: styles$5.circle
|
|
1363
|
-
}), /*#__PURE__*/React.createElement(HandIcon, {
|
|
1364
|
-
className: styles$5.hand
|
|
1365
|
-
})));
|
|
1366
|
-
};
|
|
1367
|
-
|
|
1368
|
-
HandTap.propTypes = propTypes$8;
|
|
1369
|
-
HandTap.defaultProps = defaultProps$8;
|
|
1370
|
-
|
|
1371
|
-
var styles$4 = {"container":"micromag-viewer-screen-container","handTap":"micromag-viewer-screen-handTap"};
|
|
1372
|
-
|
|
1373
|
-
var propTypes$7 = {
|
|
1374
1676
|
screen: PropTypes$1.screenComponent,
|
|
1375
1677
|
renderContext: PropTypes$1.renderContext,
|
|
1376
1678
|
screenState: PropTypes.string,
|
|
@@ -1380,10 +1682,10 @@ var propTypes$7 = {
|
|
|
1380
1682
|
width: PropTypes.number,
|
|
1381
1683
|
height: PropTypes.number,
|
|
1382
1684
|
scale: PropTypes.number,
|
|
1383
|
-
withNavigationHint: PropTypes.
|
|
1685
|
+
// withNavigationHint: PropTypes.bool, // @todo
|
|
1384
1686
|
className: PropTypes.string
|
|
1385
1687
|
};
|
|
1386
|
-
var defaultProps$
|
|
1688
|
+
var defaultProps$8 = {
|
|
1387
1689
|
screen: null,
|
|
1388
1690
|
renderContext: null,
|
|
1389
1691
|
screenState: null,
|
|
@@ -1393,7 +1695,7 @@ var defaultProps$7 = {
|
|
|
1393
1695
|
width: null,
|
|
1394
1696
|
height: null,
|
|
1395
1697
|
scale: null,
|
|
1396
|
-
withNavigationHint: false,
|
|
1698
|
+
// withNavigationHint: false,
|
|
1397
1699
|
className: null
|
|
1398
1700
|
};
|
|
1399
1701
|
|
|
@@ -1407,10 +1709,9 @@ function ViewerScreen(_ref) {
|
|
|
1407
1709
|
width = _ref.width,
|
|
1408
1710
|
height = _ref.height,
|
|
1409
1711
|
scale = _ref.scale,
|
|
1410
|
-
withNavigationHint = _ref.withNavigationHint,
|
|
1411
1712
|
className = _ref.className;
|
|
1412
1713
|
return /*#__PURE__*/React.createElement("div", {
|
|
1413
|
-
className: classNames([styles$
|
|
1714
|
+
className: classNames([styles$5.container, _defineProperty({}, className, className !== null)])
|
|
1414
1715
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1415
1716
|
style: {
|
|
1416
1717
|
width: width,
|
|
@@ -1425,62 +1726,131 @@ function ViewerScreen(_ref) {
|
|
|
1425
1726
|
active: active,
|
|
1426
1727
|
current: current,
|
|
1427
1728
|
mediaRef: mediaRef
|
|
1428
|
-
}))
|
|
1429
|
-
className: styles$4.handTap
|
|
1430
|
-
}) : null);
|
|
1729
|
+
})));
|
|
1431
1730
|
}
|
|
1432
1731
|
|
|
1433
|
-
ViewerScreen.propTypes = propTypes$
|
|
1434
|
-
ViewerScreen.defaultProps = defaultProps$
|
|
1732
|
+
ViewerScreen.propTypes = propTypes$8;
|
|
1733
|
+
ViewerScreen.defaultProps = defaultProps$8;
|
|
1734
|
+
|
|
1735
|
+
var styles$4 = {"arrow":"micromag-viewer-buttons-navigation-button-arrow","next":"micromag-viewer-buttons-navigation-button-next","previous":"micromag-viewer-buttons-navigation-button-previous"};
|
|
1736
|
+
|
|
1737
|
+
var propTypes$7 = {
|
|
1738
|
+
direction: PropTypes.oneOf(['previous', 'next']),
|
|
1739
|
+
onClick: PropTypes.func,
|
|
1740
|
+
className: PropTypes.string
|
|
1741
|
+
};
|
|
1742
|
+
var defaultProps$7 = {
|
|
1743
|
+
direction: 'next',
|
|
1744
|
+
onClick: null,
|
|
1745
|
+
className: null
|
|
1746
|
+
};
|
|
1747
|
+
|
|
1748
|
+
var NavigationButton = function NavigationButton(_ref) {
|
|
1749
|
+
var direction = _ref.direction,
|
|
1750
|
+
onClick = _ref.onClick,
|
|
1751
|
+
className = _ref.className;
|
|
1752
|
+
return /*#__PURE__*/React.createElement(IconButton, {
|
|
1753
|
+
className: classNames([styles$4.container, styles$4[direction], _defineProperty({}, className, className !== null)]),
|
|
1754
|
+
onClick: onClick,
|
|
1755
|
+
iconPosition: direction === 'next' ? 'right' : 'left',
|
|
1756
|
+
icon: /*#__PURE__*/React.createElement("svg", {
|
|
1757
|
+
className: styles$4.arrow,
|
|
1758
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1759
|
+
width: "10",
|
|
1760
|
+
height: "16",
|
|
1761
|
+
viewBox: "0 0 10 16",
|
|
1762
|
+
fill: "currentColor"
|
|
1763
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
1764
|
+
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"
|
|
1765
|
+
})),
|
|
1766
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
1767
|
+
className: "sr-only"
|
|
1768
|
+
}, direction === 'previous' ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1769
|
+
id: "zYH/31",
|
|
1770
|
+
defaultMessage: [{
|
|
1771
|
+
"type": 0,
|
|
1772
|
+
"value": "Go to previous screen"
|
|
1773
|
+
}]
|
|
1774
|
+
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1775
|
+
id: "v9bqYj",
|
|
1776
|
+
defaultMessage: [{
|
|
1777
|
+
"type": 0,
|
|
1778
|
+
"value": "Go to next screen"
|
|
1779
|
+
}]
|
|
1780
|
+
}))
|
|
1781
|
+
});
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
NavigationButton.propTypes = propTypes$7;
|
|
1785
|
+
NavigationButton.defaultProps = defaultProps$7;
|
|
1435
1786
|
|
|
1436
|
-
var styles$3 = {"container":"micromag-viewer-partials-
|
|
1787
|
+
var styles$3 = {"container":"micromag-viewer-partials-arrow-hint-container","inner":"micromag-viewer-partials-arrow-hint-inner","shadowFade":"micromag-viewer-partials-arrow-hint-shadowFade","arrow":"micromag-viewer-partials-arrow-hint-arrow","panX":"micromag-viewer-partials-arrow-hint-panX"};
|
|
1437
1788
|
|
|
1438
1789
|
var propTypes$6 = {
|
|
1439
|
-
direction: PropTypes.oneOf(['previous', 'next']),
|
|
1440
|
-
onClick: null,
|
|
1441
1790
|
className: PropTypes.string
|
|
1442
1791
|
};
|
|
1443
1792
|
var defaultProps$6 = {
|
|
1444
|
-
direction: 'next',
|
|
1445
|
-
onClick: null,
|
|
1446
1793
|
className: null
|
|
1447
1794
|
};
|
|
1448
1795
|
|
|
1449
|
-
var
|
|
1450
|
-
var
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
onClick: onClick
|
|
1457
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1796
|
+
var ArrowHint = function ArrowHint(_ref) {
|
|
1797
|
+
var className = _ref.className;
|
|
1798
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1799
|
+
className: classNames([styles$3.container, _defineProperty({}, className, className !== null)])
|
|
1800
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1801
|
+
className: styles$3.inner
|
|
1802
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
1458
1803
|
className: styles$3.arrow,
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1804
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1805
|
+
width: "10",
|
|
1806
|
+
height: "16",
|
|
1807
|
+
viewBox: "0 0 10 16",
|
|
1808
|
+
fill: "currentColor"
|
|
1809
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
1810
|
+
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"
|
|
1811
|
+
}))));
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
ArrowHint.propTypes = propTypes$6;
|
|
1815
|
+
ArrowHint.defaultProps = defaultProps$6;
|
|
1816
|
+
|
|
1817
|
+
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"};
|
|
1818
|
+
|
|
1819
|
+
var stopDragEventsPropagation = {
|
|
1820
|
+
onTouchMove: function onTouchMove(e) {
|
|
1821
|
+
return e.stopPropagation();
|
|
1822
|
+
},
|
|
1823
|
+
onTouchStart: function onTouchStart(e) {
|
|
1824
|
+
return e.stopPropagation();
|
|
1825
|
+
},
|
|
1826
|
+
onTouchEnd: function onTouchEnd(e) {
|
|
1827
|
+
return e.stopPropagation();
|
|
1828
|
+
},
|
|
1829
|
+
onPointerMove: function onPointerMove(e) {
|
|
1830
|
+
return e.stopPropagation();
|
|
1831
|
+
},
|
|
1832
|
+
onPointerUp: function onPointerUp(e) {
|
|
1833
|
+
return e.stopPropagation();
|
|
1834
|
+
},
|
|
1835
|
+
onPointerDown: function onPointerDown(e) {
|
|
1836
|
+
return e.stopPropagation();
|
|
1837
|
+
}
|
|
1475
1838
|
};
|
|
1476
1839
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1840
|
+
function getFormattedTimestamp(s) {
|
|
1841
|
+
var withMilliseconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1842
|
+
var sparts = withMilliseconds ? "".concat(s).split('.') : [];
|
|
1843
|
+
var ms = sparts.length > 1 ? ":".concat(sparts[1].substring(0, 3)) : '';
|
|
1844
|
+
return (s - (s %= 60)) / 60 + (9 < s ? ':' : ':0') + ~~s + ms; // eslint-disable-line
|
|
1845
|
+
}
|
|
1479
1846
|
|
|
1480
|
-
var
|
|
1847
|
+
var SHOW_MILLISECONDS_THRESHOLD = 5; // show milliseconds when scrubbing if length of video is shorter than 5 seconds
|
|
1481
1848
|
|
|
1482
1849
|
var propTypes$5 = {
|
|
1483
|
-
media: PropTypes.
|
|
1850
|
+
media: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
1851
|
+
current: PropTypes.any
|
|
1852
|
+
}) // eslint-disable-line
|
|
1853
|
+
]),
|
|
1484
1854
|
playing: PropTypes.bool,
|
|
1485
1855
|
backgroundColor: PropTypes.string,
|
|
1486
1856
|
progressColor: PropTypes.string,
|
|
@@ -1505,7 +1875,7 @@ var defaultProps$5 = {
|
|
|
1505
1875
|
};
|
|
1506
1876
|
|
|
1507
1877
|
var SeekBar = function SeekBar(_ref) {
|
|
1508
|
-
var
|
|
1878
|
+
var _ref4;
|
|
1509
1879
|
|
|
1510
1880
|
var media = _ref.media,
|
|
1511
1881
|
playing = _ref.playing,
|
|
@@ -1521,13 +1891,26 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1521
1891
|
var progress = useMediaProgress(media, {
|
|
1522
1892
|
disabled: !playing
|
|
1523
1893
|
});
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1894
|
+
|
|
1895
|
+
var _ref2 = media || {},
|
|
1896
|
+
_ref2$currentTime = _ref2.currentTime,
|
|
1897
|
+
currentTime = _ref2$currentTime === void 0 ? null : _ref2$currentTime,
|
|
1898
|
+
_ref2$duration = _ref2.duration,
|
|
1899
|
+
duration = _ref2$duration === void 0 ? null : _ref2$duration;
|
|
1900
|
+
|
|
1901
|
+
var _useState = useState(false),
|
|
1902
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1903
|
+
showTimestamp = _useState2[0],
|
|
1904
|
+
setShowTimestamp = _useState2[1];
|
|
1905
|
+
|
|
1906
|
+
var onDrag = useCallback(function (_ref3) {
|
|
1907
|
+
_ref3.event;
|
|
1908
|
+
var _ref3$xy = _slicedToArray(_ref3.xy, 1),
|
|
1909
|
+
x = _ref3$xy[0],
|
|
1910
|
+
elapsedTime = _ref3.elapsedTime,
|
|
1911
|
+
active = _ref3.active,
|
|
1912
|
+
tap = _ref3.tap,
|
|
1913
|
+
currentTarget = _ref3.currentTarget;
|
|
1531
1914
|
|
|
1532
1915
|
if (!active && elapsedTime > 300) {
|
|
1533
1916
|
return;
|
|
@@ -1544,15 +1927,18 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1544
1927
|
}
|
|
1545
1928
|
}, [onSeek]);
|
|
1546
1929
|
var onDragStart = useCallback(function () {
|
|
1930
|
+
setShowTimestamp(true);
|
|
1931
|
+
|
|
1547
1932
|
if (onSeekStart !== null) {
|
|
1548
1933
|
onSeekStart();
|
|
1549
1934
|
}
|
|
1550
|
-
}, [onSeekStart]);
|
|
1935
|
+
}, [onSeekStart, setShowTimestamp]);
|
|
1551
1936
|
var onDragEnd = useCallback(function () {
|
|
1552
1937
|
if (onSeekEnd !== null) {
|
|
1938
|
+
setShowTimestamp(false);
|
|
1553
1939
|
onSeekEnd();
|
|
1554
1940
|
}
|
|
1555
|
-
}, [onSeekEnd]);
|
|
1941
|
+
}, [onSeekEnd, setShowTimestamp]);
|
|
1556
1942
|
var bind = useGesture({
|
|
1557
1943
|
onDrag: onDrag,
|
|
1558
1944
|
onDragStart: onDragStart,
|
|
@@ -1563,9 +1949,9 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1563
1949
|
filterTaps: true
|
|
1564
1950
|
}
|
|
1565
1951
|
});
|
|
1566
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1567
|
-
className: classNames([styles$2.container, (
|
|
1568
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1952
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1953
|
+
className: classNames([styles$2.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$2.withSeekHead, withSeekHead), _defineProperty(_ref4, styles$2.showTimestamp, showTimestamp), _ref4)])
|
|
1954
|
+
}, stopDragEventsPropagation), /*#__PURE__*/React.createElement("div", {
|
|
1569
1955
|
className: styles$2.inner
|
|
1570
1956
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1571
1957
|
className: styles$2.progressBar,
|
|
@@ -1578,7 +1964,12 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1578
1964
|
left: "".concat(progress * 100, "%"),
|
|
1579
1965
|
backgroundColor: progressColor
|
|
1580
1966
|
}
|
|
1581
|
-
}
|
|
1967
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1968
|
+
className: styles$2.scrubbedTime,
|
|
1969
|
+
style: {
|
|
1970
|
+
borderColor: progressColor
|
|
1971
|
+
}
|
|
1972
|
+
}, getFormattedTimestamp(currentTime, duration < SHOW_MILLISECONDS_THRESHOLD))), /*#__PURE__*/React.createElement("div", {
|
|
1582
1973
|
className: styles$2.progress,
|
|
1583
1974
|
style: {
|
|
1584
1975
|
transform: "scaleX(".concat(progress, ")"),
|
|
@@ -1608,7 +1999,7 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1608
1999
|
SeekBar.propTypes = propTypes$5;
|
|
1609
2000
|
SeekBar.defaultProps = defaultProps$5;
|
|
1610
2001
|
|
|
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","
|
|
2002
|
+
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
2003
|
|
|
1613
2004
|
var propTypes$4 = {
|
|
1614
2005
|
className: PropTypes.string,
|
|
@@ -1713,7 +2104,8 @@ function PlaybackControls(_ref) {
|
|
|
1713
2104
|
setPlaying(true);
|
|
1714
2105
|
}
|
|
1715
2106
|
}, [setPlaying, wasPlaying]);
|
|
1716
|
-
var
|
|
2107
|
+
var hasMedia = mediaElement !== null;
|
|
2108
|
+
var mediaHasAudio = hasMedia && (hasAudio === null || hasAudio === true);
|
|
1717
2109
|
|
|
1718
2110
|
var _ref3 = customControlsTheme || {},
|
|
1719
2111
|
color = _ref3.color,
|
|
@@ -1722,33 +2114,55 @@ function PlaybackControls(_ref) {
|
|
|
1722
2114
|
|
|
1723
2115
|
var isCollapsed = controls && !controlsVisible && playing || !controls && mediaHasAudio;
|
|
1724
2116
|
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",
|
|
2117
|
+
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)])
|
|
2118
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
1728
2119
|
className: styles$1.playPauseButton,
|
|
1729
2120
|
style: {
|
|
1730
2121
|
color: color
|
|
1731
2122
|
},
|
|
1732
2123
|
onClick: playing ? onPause : onPlay,
|
|
1733
|
-
|
|
1734
|
-
|
|
2124
|
+
focusable: controlsVisible,
|
|
2125
|
+
icon: playing ? /*#__PURE__*/React.createElement("svg", {
|
|
2126
|
+
className: styles$1.icon,
|
|
2127
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2128
|
+
width: "10",
|
|
2129
|
+
height: "16",
|
|
2130
|
+
viewBox: "0 0 10 16",
|
|
2131
|
+
fill: "currentColor"
|
|
2132
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
2133
|
+
x: "1",
|
|
2134
|
+
y: "3.27",
|
|
2135
|
+
width: "3",
|
|
2136
|
+
height: "9.69"
|
|
2137
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
2138
|
+
x: "6",
|
|
2139
|
+
y: "3.27",
|
|
2140
|
+
width: "3",
|
|
2141
|
+
height: "9.69"
|
|
2142
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
2143
|
+
className: styles$1.icon,
|
|
2144
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2145
|
+
width: "10",
|
|
2146
|
+
height: "16",
|
|
2147
|
+
viewBox: "0 0 10 16",
|
|
2148
|
+
fill: "currentColor"
|
|
2149
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2150
|
+
d: "M1,3.16V12.84l8-4.84L1,3.16"
|
|
2151
|
+
})),
|
|
2152
|
+
"aria-label": playing ? intl.formatMessage({
|
|
2153
|
+
id: "mTqcmA",
|
|
1735
2154
|
defaultMessage: [{
|
|
1736
2155
|
"type": 0,
|
|
1737
|
-
"value": "
|
|
2156
|
+
"value": "Pause"
|
|
1738
2157
|
}]
|
|
1739
|
-
})
|
|
1740
|
-
"aria-label": intl.formatMessage({
|
|
2158
|
+
}) : intl.formatMessage({
|
|
1741
2159
|
id: "ahSpiH",
|
|
1742
2160
|
defaultMessage: [{
|
|
1743
2161
|
"type": 0,
|
|
1744
2162
|
"value": "Play"
|
|
1745
2163
|
}]
|
|
1746
|
-
})
|
|
1747
|
-
|
|
1748
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1749
|
-
className: styles$1.icon,
|
|
1750
|
-
icon: playing ? faPause : faPlay
|
|
1751
|
-
})), /*#__PURE__*/React.createElement(SeekBar, {
|
|
2164
|
+
})
|
|
2165
|
+
}), /*#__PURE__*/React.createElement(SeekBar, {
|
|
1752
2166
|
className: styles$1.seekBar,
|
|
1753
2167
|
media: mediaElement,
|
|
1754
2168
|
playing: playing,
|
|
@@ -1759,32 +2173,54 @@ function PlaybackControls(_ref) {
|
|
|
1759
2173
|
withSeekHead: !isCollapsed && !seekBarOnly,
|
|
1760
2174
|
backgroundColor: color,
|
|
1761
2175
|
progressColor: progressColor
|
|
1762
|
-
}), /*#__PURE__*/React.createElement(
|
|
1763
|
-
|
|
1764
|
-
className: classNames([styles$1.muteButton, _defineProperty({}, styles$1.isMuted, muted)]),
|
|
2176
|
+
}), /*#__PURE__*/React.createElement(Button$1, {
|
|
2177
|
+
className: styles$1.muteButton,
|
|
1765
2178
|
style: {
|
|
1766
2179
|
color: color
|
|
1767
2180
|
},
|
|
1768
2181
|
onClick: muted ? onUnmute : onMute,
|
|
1769
|
-
|
|
1770
|
-
|
|
2182
|
+
focusable: controlsVisible || mediaHasAudio,
|
|
2183
|
+
icon: muted ? /*#__PURE__*/React.createElement("svg", {
|
|
2184
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2185
|
+
width: "10",
|
|
2186
|
+
height: "16",
|
|
2187
|
+
viewBox: "0 0 10 16",
|
|
2188
|
+
className: styles$1.icon,
|
|
2189
|
+
fill: "currentColor"
|
|
2190
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
2191
|
+
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"
|
|
2192
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
2193
|
+
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"
|
|
2194
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
2195
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2196
|
+
width: "10",
|
|
2197
|
+
height: "16",
|
|
2198
|
+
viewBox: "0 0 10 16",
|
|
2199
|
+
className: styles$1.icon,
|
|
2200
|
+
fill: "currentColor"
|
|
2201
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
2202
|
+
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"
|
|
2203
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
2204
|
+
cx: "6.14",
|
|
2205
|
+
cy: "8",
|
|
2206
|
+
r: ".99"
|
|
2207
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2208
|
+
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"
|
|
2209
|
+
})),
|
|
2210
|
+
"aria-label": muted ? intl.formatMessage({
|
|
2211
|
+
id: "RK/QEY",
|
|
1771
2212
|
defaultMessage: [{
|
|
1772
2213
|
"type": 0,
|
|
1773
|
-
"value": "
|
|
2214
|
+
"value": "Unmute"
|
|
1774
2215
|
}]
|
|
1775
|
-
})
|
|
1776
|
-
"aria-label": intl.formatMessage({
|
|
2216
|
+
}) : intl.formatMessage({
|
|
1777
2217
|
id: "vzg8Es",
|
|
1778
2218
|
defaultMessage: [{
|
|
1779
2219
|
"type": 0,
|
|
1780
2220
|
"value": "Mute"
|
|
1781
2221
|
}]
|
|
1782
|
-
})
|
|
1783
|
-
|
|
1784
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1785
|
-
className: styles$1.icon,
|
|
1786
|
-
icon: faVolumeUp
|
|
1787
|
-
})));
|
|
2222
|
+
})
|
|
2223
|
+
}));
|
|
1788
2224
|
}
|
|
1789
2225
|
|
|
1790
2226
|
PlaybackControls.propTypes = propTypes$4;
|
|
@@ -1877,6 +2313,15 @@ function WebViewContainer(_ref) {
|
|
|
1877
2313
|
WebViewContainer.propTypes = propTypes$3;
|
|
1878
2314
|
WebViewContainer.defaultProps = defaultProps$3;
|
|
1879
2315
|
|
|
2316
|
+
var SPRING_CONFIG_TIGHT = {
|
|
2317
|
+
tension: 300,
|
|
2318
|
+
friction: 35
|
|
2319
|
+
}; // tight
|
|
2320
|
+
|
|
2321
|
+
var DRAG_PROGRESS_ACTIVATION_THRESHOLD = 0.3;
|
|
2322
|
+
var DRAG_VELOCITY_ACTIVATION_THRESHOLD = 0.3;
|
|
2323
|
+
var DEFAULT_TRANSITION_TYPE_LANDSCAPE = 'carousel';
|
|
2324
|
+
var DEFAULT_TRANSITION_TYPE_PORTRAIT = 'stack';
|
|
1880
2325
|
var propTypes$2 = {
|
|
1881
2326
|
story: PropTypes$1.story,
|
|
1882
2327
|
// .isRequired,
|
|
@@ -1891,18 +2336,20 @@ var propTypes$2 = {
|
|
|
1891
2336
|
visitor: PropTypes$1.visitor,
|
|
1892
2337
|
onScreenChange: PropTypes.func,
|
|
1893
2338
|
tapNextScreenWidthPercent: PropTypes.number,
|
|
1894
|
-
neighborScreensActive: PropTypes.number,
|
|
1895
|
-
neighborScreensMounted: PropTypes.number,
|
|
1896
2339
|
storyIsParsed: PropTypes.bool,
|
|
1897
|
-
|
|
1898
|
-
|
|
2340
|
+
neighborScreensActive: PropTypes.number,
|
|
2341
|
+
neighborScreenOffset: PropTypes.number,
|
|
2342
|
+
neighborScreenScale: PropTypes.number,
|
|
1899
2343
|
withMetadata: PropTypes.bool,
|
|
2344
|
+
withoutGestures: PropTypes.bool,
|
|
1900
2345
|
withoutMenu: PropTypes.bool,
|
|
1901
2346
|
withoutScreensMenu: PropTypes.bool,
|
|
1902
2347
|
withoutShareMenu: PropTypes.bool,
|
|
1903
2348
|
withoutMenuShadow: PropTypes.bool,
|
|
1904
2349
|
withoutFullscreen: PropTypes.bool,
|
|
1905
|
-
|
|
2350
|
+
withoutNavigationArrow: PropTypes.bool,
|
|
2351
|
+
withoutTransitions: PropTypes.bool,
|
|
2352
|
+
withNeighborScreens: PropTypes.bool,
|
|
1906
2353
|
withNavigationHint: PropTypes.bool,
|
|
1907
2354
|
withoutPlaybackControls: PropTypes.bool,
|
|
1908
2355
|
closeable: PropTypes.bool,
|
|
@@ -1933,19 +2380,21 @@ var defaultProps$2 = {
|
|
|
1933
2380
|
visitor: null,
|
|
1934
2381
|
onScreenChange: null,
|
|
1935
2382
|
tapNextScreenWidthPercent: 0.8,
|
|
1936
|
-
neighborScreensActive: 1,
|
|
1937
|
-
neighborScreensMounted: 1,
|
|
1938
2383
|
storyIsParsed: false,
|
|
1939
|
-
|
|
1940
|
-
|
|
2384
|
+
neighborScreensActive: 2,
|
|
2385
|
+
neighborScreenOffset: 105,
|
|
2386
|
+
neighborScreenScale: 0.8,
|
|
1941
2387
|
withMetadata: false,
|
|
2388
|
+
withNeighborScreens: false,
|
|
2389
|
+
withNavigationHint: false,
|
|
2390
|
+
withoutGestures: false,
|
|
1942
2391
|
withoutMenu: false,
|
|
1943
2392
|
withoutScreensMenu: false,
|
|
1944
2393
|
withoutShareMenu: false,
|
|
1945
2394
|
withoutMenuShadow: false,
|
|
1946
2395
|
withoutFullscreen: false,
|
|
1947
|
-
|
|
1948
|
-
|
|
2396
|
+
withoutTransitions: false,
|
|
2397
|
+
withoutNavigationArrow: false,
|
|
1949
2398
|
withoutPlaybackControls: false,
|
|
1950
2399
|
menuIsScreenWidth: false,
|
|
1951
2400
|
closeable: false,
|
|
@@ -1973,18 +2422,20 @@ var Viewer = function Viewer(_ref) {
|
|
|
1973
2422
|
renderContext = _ref.renderContext,
|
|
1974
2423
|
visitor = _ref.visitor,
|
|
1975
2424
|
tapNextScreenWidthPercent = _ref.tapNextScreenWidthPercent,
|
|
1976
|
-
neighborScreensActive = _ref.neighborScreensActive,
|
|
1977
|
-
neighborScreensMounted = _ref.neighborScreensMounted,
|
|
1978
2425
|
storyIsParsed = _ref.storyIsParsed,
|
|
1979
|
-
|
|
1980
|
-
|
|
2426
|
+
neighborScreensActive = _ref.neighborScreensActive,
|
|
2427
|
+
neighborScreenOffset = _ref.neighborScreenOffset,
|
|
2428
|
+
neighborScreenScale = _ref.neighborScreenScale,
|
|
1981
2429
|
withMetadata = _ref.withMetadata,
|
|
2430
|
+
withoutGestures = _ref.withoutGestures,
|
|
1982
2431
|
withoutMenu = _ref.withoutMenu,
|
|
1983
2432
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1984
2433
|
withoutShareMenu = _ref.withoutShareMenu,
|
|
1985
2434
|
withoutMenuShadow = _ref.withoutMenuShadow;
|
|
1986
2435
|
_ref.withoutFullscreen;
|
|
1987
|
-
var
|
|
2436
|
+
var withoutNavigationArrow = _ref.withoutNavigationArrow,
|
|
2437
|
+
withoutTransitions = _ref.withoutTransitions,
|
|
2438
|
+
withNeighborScreens = _ref.withNeighborScreens,
|
|
1988
2439
|
withNavigationHint = _ref.withNavigationHint,
|
|
1989
2440
|
withoutPlaybackControls = _ref.withoutPlaybackControls,
|
|
1990
2441
|
menuIsScreenWidth = _ref.menuIsScreenWidth,
|
|
@@ -1998,7 +2449,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
1998
2449
|
screensMedias = _ref.screensMedias,
|
|
1999
2450
|
screenSizeOptions = _ref.screenSizeOptions,
|
|
2000
2451
|
className = _ref.className;
|
|
2001
|
-
|
|
2452
|
+
|
|
2453
|
+
/**
|
|
2454
|
+
* Screen Data + Processing
|
|
2455
|
+
*/
|
|
2002
2456
|
var parsedStory = useParsedStory(story, {
|
|
2003
2457
|
disabled: storyIsParsed
|
|
2004
2458
|
}) || {};
|
|
@@ -2010,20 +2464,59 @@ var Viewer = function Viewer(_ref) {
|
|
|
2010
2464
|
metadata = _parsedStory$metadata === void 0 ? null : _parsedStory$metadata,
|
|
2011
2465
|
_parsedStory$fonts = parsedStory.fonts,
|
|
2012
2466
|
fonts = _parsedStory$fonts === void 0 ? null : _parsedStory$fonts;
|
|
2467
|
+
var screensCount = screens.length;
|
|
2013
2468
|
var eventsManager = useMemo(function () {
|
|
2014
2469
|
return new EventEmitter();
|
|
2015
|
-
}, [parsedStory]);
|
|
2470
|
+
}, [parsedStory]);
|
|
2471
|
+
var screenIndex = useMemo(function () {
|
|
2472
|
+
return Math.max(0, screens.findIndex(function (it) {
|
|
2473
|
+
return "".concat(it.id) === "".concat(screenId);
|
|
2474
|
+
}));
|
|
2475
|
+
}, [screenId, screens]);
|
|
2476
|
+
var currentScreen = screens[screenIndex] || null;
|
|
2477
|
+
|
|
2478
|
+
var _ref2 = currentScreen || {},
|
|
2479
|
+
screenParameters = _ref2.parameters;
|
|
2480
|
+
|
|
2481
|
+
var _ref3 = screenParameters || {},
|
|
2482
|
+
screenMetadata = _ref3.metadata;
|
|
2483
|
+
|
|
2484
|
+
var _ref4 = screenMetadata || {},
|
|
2485
|
+
_ref4$title = _ref4.title,
|
|
2486
|
+
screenTitle = _ref4$title === void 0 ? null : _ref4$title,
|
|
2487
|
+
_ref4$description = _ref4.description,
|
|
2488
|
+
screenDescription = _ref4$description === void 0 ? null : _ref4$description;
|
|
2489
|
+
|
|
2490
|
+
var finalTitle = screenTitle !== null ? screenTitle : title;
|
|
2491
|
+
var finalMetadata = useMemo(function () {
|
|
2492
|
+
return screenDescription !== null ? _objectSpread(_objectSpread({}, metadata), {}, {
|
|
2493
|
+
description: screenDescription
|
|
2494
|
+
}) : metadata;
|
|
2495
|
+
}, [metadata, screenDescription]);
|
|
2496
|
+
var screensMediasRef = useRef([]);
|
|
2497
|
+
|
|
2498
|
+
if (currentScreenMedia !== null) {
|
|
2499
|
+
currentScreenMedia.current = screensMediasRef.current[screenIndex] || null;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
if (screensMedias !== null) {
|
|
2503
|
+
screensMedias.current = screensMediasRef.current;
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* Screen Layout
|
|
2507
|
+
*/
|
|
2016
2508
|
|
|
2017
|
-
var _ref2 = viewerTheme || {},
|
|
2018
|
-
textStyles = _ref2.textStyles;
|
|
2019
2509
|
|
|
2020
|
-
var
|
|
2021
|
-
|
|
2022
|
-
themeTextStyle = _ref3$title === void 0 ? null : _ref3$title;
|
|
2510
|
+
var _ref5 = viewerTheme || {},
|
|
2511
|
+
textStyles = _ref5.textStyles;
|
|
2023
2512
|
|
|
2024
|
-
var
|
|
2025
|
-
|
|
2026
|
-
|
|
2513
|
+
var _ref6 = textStyles || {},
|
|
2514
|
+
_ref6$title = _ref6.title,
|
|
2515
|
+
themeTextStyle = _ref6$title === void 0 ? null : _ref6$title;
|
|
2516
|
+
|
|
2517
|
+
var _ref7 = themeTextStyle || {},
|
|
2518
|
+
_ref7$fontFamily = _ref7.fontFamily,
|
|
2519
|
+
themeFont = _ref7$fontFamily === void 0 ? null : _ref7$fontFamily; // Fonts
|
|
2027
2520
|
|
|
2028
2521
|
|
|
2029
2522
|
var finalFonts = useMemo(function () {
|
|
@@ -2050,8 +2543,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
2050
2543
|
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
2051
2544
|
playbackMedia = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m;
|
|
2052
2545
|
|
|
2053
|
-
var
|
|
2054
|
-
|
|
2546
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
2547
|
+
playbackControlsContainerRef = _useDimensionObserver.ref,
|
|
2548
|
+
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
2549
|
+
playbackControlsContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
2550
|
+
|
|
2551
|
+
var trackScreenView = useTrackScreenView(); // Get screen size
|
|
2055
2552
|
|
|
2056
2553
|
var _useScreenSizeFromEle = useScreenSizeFromElement(_objectSpread({
|
|
2057
2554
|
width: width,
|
|
@@ -2062,21 +2559,26 @@ var Viewer = function Viewer(_ref) {
|
|
|
2062
2559
|
screenSize = _useScreenSizeFromEle.screenSize,
|
|
2063
2560
|
screenScale = _useScreenSizeFromEle.scale;
|
|
2064
2561
|
|
|
2065
|
-
var
|
|
2066
|
-
|
|
2067
|
-
screenWidth =
|
|
2068
|
-
|
|
2069
|
-
screenHeight =
|
|
2070
|
-
|
|
2071
|
-
landscape =
|
|
2072
|
-
|
|
2073
|
-
menuOverScreen =
|
|
2562
|
+
var _ref8 = screenSize || {},
|
|
2563
|
+
_ref8$width = _ref8.width,
|
|
2564
|
+
screenWidth = _ref8$width === void 0 ? null : _ref8$width,
|
|
2565
|
+
_ref8$height = _ref8.height,
|
|
2566
|
+
screenHeight = _ref8$height === void 0 ? null : _ref8$height,
|
|
2567
|
+
_ref8$landscape = _ref8.landscape,
|
|
2568
|
+
landscape = _ref8$landscape === void 0 ? false : _ref8$landscape,
|
|
2569
|
+
_ref8$menuOverScreen = _ref8.menuOverScreen,
|
|
2570
|
+
menuOverScreen = _ref8$menuOverScreen === void 0 ? false : _ref8$menuOverScreen;
|
|
2074
2571
|
|
|
2075
2572
|
var screenContainerWidth = screenScale !== null ? screenWidth * screenScale : screenWidth;
|
|
2076
2573
|
var screenContainerHeight = screenScale !== null ? screenHeight * screenScale : screenHeight;
|
|
2077
2574
|
var hasSize = screenWidth > 0 && screenHeight > 0;
|
|
2078
|
-
var ready = hasSize;
|
|
2079
|
-
|
|
2575
|
+
var ready = hasSize;
|
|
2576
|
+
var trackingEnabled = isView;
|
|
2577
|
+
useEffect(function () {
|
|
2578
|
+
if (trackingEnabled && currentScreen !== null) {
|
|
2579
|
+
trackScreenView(currentScreen, screenIndex);
|
|
2580
|
+
}
|
|
2581
|
+
}, [currentScreen, trackScreenView, trackingEnabled]);
|
|
2080
2582
|
useEffect(function () {
|
|
2081
2583
|
if (ready && onViewModeChange !== null) {
|
|
2082
2584
|
onViewModeChange({
|
|
@@ -2085,21 +2587,14 @@ var Viewer = function Viewer(_ref) {
|
|
|
2085
2587
|
});
|
|
2086
2588
|
}
|
|
2087
2589
|
}, [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
|
-
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Screen Transitions
|
|
2592
|
+
*/
|
|
2099
2593
|
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2594
|
+
var transitionType = landscape && withNeighborScreens ? DEFAULT_TRANSITION_TYPE_LANDSCAPE : DEFAULT_TRANSITION_TYPE_PORTRAIT;
|
|
2595
|
+
/**
|
|
2596
|
+
* Screen Navigation
|
|
2597
|
+
*/
|
|
2103
2598
|
|
|
2104
2599
|
var changeIndex = useCallback(function (index) {
|
|
2105
2600
|
if (index === screenIndex) {
|
|
@@ -2113,23 +2608,37 @@ var Viewer = function Viewer(_ref) {
|
|
|
2113
2608
|
if (onScreenChange !== null) {
|
|
2114
2609
|
onScreenChange(screens[index], index);
|
|
2115
2610
|
}
|
|
2116
|
-
}, [screenIndex, screens, onScreenChange]);
|
|
2611
|
+
}, [screenIndex, screens, onScreenChange]);
|
|
2612
|
+
var onScreenNavigate = useCallback(function (_ref9) {
|
|
2613
|
+
var index = _ref9.index,
|
|
2614
|
+
newIndex = _ref9.newIndex,
|
|
2615
|
+
end = _ref9.end,
|
|
2616
|
+
direction = _ref9.direction;
|
|
2117
2617
|
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
useEffect(function () {
|
|
2121
|
-
if (trackingEnabled && currentScreen !== null) {
|
|
2122
|
-
trackScreenView(currentScreen, screenIndex);
|
|
2618
|
+
if (end && onEnd !== null) {
|
|
2619
|
+
onEnd();
|
|
2123
2620
|
}
|
|
2124
|
-
}, [currentScreen, trackScreenView, trackingEnabled]); // Handle interaction enable
|
|
2125
2621
|
|
|
2622
|
+
changeIndex(newIndex);
|
|
2623
|
+
eventsManager.emit('navigate', {
|
|
2624
|
+
index: index,
|
|
2625
|
+
newIndex: newIndex,
|
|
2626
|
+
direction: direction,
|
|
2627
|
+
end: end
|
|
2628
|
+
});
|
|
2629
|
+
|
|
2630
|
+
if (end) {
|
|
2631
|
+
eventsManager.emit('navigate_end');
|
|
2632
|
+
} else {
|
|
2633
|
+
eventsManager.emit("navigate_".concat(direction), newIndex);
|
|
2634
|
+
}
|
|
2635
|
+
}, [onEnd, changeIndex]);
|
|
2126
2636
|
var gotoPreviousScreen = useCallback(function () {
|
|
2127
2637
|
changeIndex(Math.max(0, screenIndex - 1));
|
|
2128
|
-
}, [changeIndex]);
|
|
2638
|
+
}, [changeIndex, screenIndex]);
|
|
2129
2639
|
var gotoNextScreen = useCallback(function () {
|
|
2130
2640
|
changeIndex(Math.min(screens.length - 1, screenIndex + 1));
|
|
2131
|
-
}, [changeIndex]);
|
|
2132
|
-
var screensCount = screens.length;
|
|
2641
|
+
}, [changeIndex, screenIndex]);
|
|
2133
2642
|
|
|
2134
2643
|
var _useState = useState(false),
|
|
2135
2644
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2145,37 +2654,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
2145
2654
|
setHasInteracted(true);
|
|
2146
2655
|
}
|
|
2147
2656
|
}, [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
2657
|
|
|
2173
2658
|
var _useScreenInteraction = useScreenInteraction({
|
|
2174
2659
|
screens: screens,
|
|
2175
2660
|
screenIndex: screenIndex,
|
|
2176
2661
|
screenWidth: screenContainerWidth,
|
|
2177
2662
|
disableCurrentScreenNavigation: !isView,
|
|
2178
|
-
clickOnSiblings: landscape && withLandscapeSiblingsScreens,
|
|
2179
2663
|
nextScreenWidthPercent: tapNextScreenWidthPercent,
|
|
2180
2664
|
onInteract: onInteractionPrivate,
|
|
2181
2665
|
onNavigate: onScreenNavigate
|
|
@@ -2183,102 +2667,127 @@ var Viewer = function Viewer(_ref) {
|
|
|
2183
2667
|
interactWithScreen = _useScreenInteraction.interact,
|
|
2184
2668
|
currentScreenInteractionEnabled = _useScreenInteraction.currentScreenInteractionEnabled,
|
|
2185
2669
|
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
|
-
|
|
2670
|
+
disableInteraction = _useScreenInteraction.disableInteraction;
|
|
2671
|
+
|
|
2672
|
+
var onTap = useCallback(function (_ref10) {
|
|
2673
|
+
var currentTarget = _ref10.currentTarget,
|
|
2674
|
+
event = _ref10.event,
|
|
2675
|
+
target = _ref10.target,
|
|
2676
|
+
_ref10$xy = _slicedToArray(_ref10.xy, 2),
|
|
2677
|
+
x = _ref10$xy[0],
|
|
2678
|
+
y = _ref10$xy[1];
|
|
2679
|
+
|
|
2680
|
+
interactWithScreen({
|
|
2681
|
+
event: event,
|
|
2682
|
+
target: target,
|
|
2683
|
+
currentTarget: currentTarget,
|
|
2684
|
+
index: screenIndex,
|
|
2685
|
+
x: x,
|
|
2686
|
+
y: y
|
|
2687
|
+
});
|
|
2688
|
+
}, [interactWithScreen, screenIndex]);
|
|
2689
|
+
var computeScreenProgress = useCallback(function (_ref11) {
|
|
2690
|
+
var active = _ref11.active,
|
|
2691
|
+
_ref11$movement = _slicedToArray(_ref11.movement, 1),
|
|
2692
|
+
mx = _ref11$movement[0],
|
|
2693
|
+
_ref11$velocity = _slicedToArray(_ref11.velocity, 1),
|
|
2694
|
+
vx = _ref11$velocity[0];
|
|
2695
|
+
|
|
2696
|
+
var p = mx / screenContainerWidth; // drag "ratio": how much of the screen width has been swiped?
|
|
2697
|
+
|
|
2698
|
+
var forwards = mx < 0; // true if swiping to left (to navigate forwards)
|
|
2699
|
+
|
|
2700
|
+
var newIndex = !forwards ? screenIndex - 1 : screenIndex + 1; // which item index are we moving towards?
|
|
2701
|
+
|
|
2702
|
+
var reachedThreshold = vx > DRAG_VELOCITY_ACTIVATION_THRESHOLD || Math.abs(p) > DRAG_PROGRESS_ACTIVATION_THRESHOLD;
|
|
2703
|
+
var reachedBounds = newIndex < 0 || newIndex >= screensCount; // have we reached the end of the stack?
|
|
2704
|
+
|
|
2705
|
+
var damper = reachedBounds ? 0.1 : 1;
|
|
2706
|
+
var progress = Math.max(-1, Math.min(1, p * damper));
|
|
2707
|
+
|
|
2708
|
+
if (!active) {
|
|
2709
|
+
return reachedThreshold && !reachedBounds ? newIndex : screenIndex;
|
|
2224
2710
|
}
|
|
2225
2711
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2712
|
+
return screenIndex - progress;
|
|
2713
|
+
}, [screenContainerWidth, screenIndex]);
|
|
2714
|
+
var onScreenProgress = useCallback(function (progress, _ref12) {
|
|
2715
|
+
var active = _ref12.active;
|
|
2716
|
+
var delta = Math.abs(progress - screenIndex);
|
|
2717
|
+
var reachedBounds = progress < 0 || progress >= screensCount; // have we reached the end of the stack?
|
|
2232
2718
|
|
|
2233
|
-
|
|
2234
|
-
var nextIndex = hasTappedLeft ? Math.max(0, screenIndex - 1) : Math.min(screensCount - 1, screenIndex + 1);
|
|
2719
|
+
if (!active && delta === 1 && !reachedBounds) {
|
|
2235
2720
|
onScreenNavigate({
|
|
2236
2721
|
index: screenIndex,
|
|
2237
|
-
newIndex:
|
|
2722
|
+
newIndex: progress
|
|
2238
2723
|
});
|
|
2239
2724
|
}
|
|
2240
|
-
}, [
|
|
2241
|
-
var
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2725
|
+
}, [onScreenNavigate, screenIndex]);
|
|
2726
|
+
var springParams = useMemo(function () {
|
|
2727
|
+
return {
|
|
2728
|
+
config: SPRING_CONFIG_TIGHT
|
|
2729
|
+
};
|
|
2730
|
+
}, []);
|
|
2731
|
+
|
|
2732
|
+
var _useDragProgress = useDragProgress({
|
|
2733
|
+
progress: screenIndex,
|
|
2734
|
+
disabled: !isView || withoutTransitions,
|
|
2735
|
+
dragDisabled: withoutGestures,
|
|
2736
|
+
computeProgress: computeScreenProgress,
|
|
2737
|
+
onProgress: onScreenProgress,
|
|
2738
|
+
onTap: onTap,
|
|
2739
|
+
springParams: springParams
|
|
2740
|
+
}),
|
|
2741
|
+
isDragging = _useDragProgress.dragging,
|
|
2742
|
+
screenIndexProgress = _useDragProgress.progress,
|
|
2743
|
+
dragContentBind = _useDragProgress.bind;
|
|
2246
2744
|
|
|
2247
|
-
|
|
2248
|
-
|
|
2745
|
+
var getScreenStylesByIndex = function getScreenStylesByIndex(index, progress) {
|
|
2746
|
+
if (transitionType === 'stack') {
|
|
2747
|
+
var _t = index - progress;
|
|
2748
|
+
|
|
2749
|
+
var _clamped = Math.min(1, Math.max(0, _t));
|
|
2750
|
+
|
|
2751
|
+
var invert = Math.min(1, Math.max(0, -_t));
|
|
2752
|
+
var opacity = Math.max(0, 1 - 0.75 * invert + (_t + 1));
|
|
2753
|
+
return {
|
|
2754
|
+
opacity: opacity,
|
|
2755
|
+
transform: "translateX(".concat(_clamped * 100, "%) scale(").concat(1 - 0.2 * invert, ")"),
|
|
2756
|
+
boxShadow: "0 0 ".concat(4 * (1 - _clamped), "rem ").concat(-0.5 * (1 - _clamped), "rem black"),
|
|
2757
|
+
zIndex: index
|
|
2758
|
+
};
|
|
2249
2759
|
}
|
|
2250
|
-
}, [withLandscapeSiblingsScreens, changeIndex, landscape, screenIndex]); // swipe menu open
|
|
2251
2760
|
|
|
2252
|
-
|
|
2761
|
+
var t = index - progress;
|
|
2762
|
+
var clamped = Math.min(1, Math.max(0, Math.abs(t)));
|
|
2763
|
+
return {
|
|
2764
|
+
opacity: 1 - 0.75 * clamped,
|
|
2765
|
+
transform: "translateX(".concat(t * neighborScreenOffset, "%) scale(").concat(1 - (1 - neighborScreenScale) * clamped, ")"),
|
|
2766
|
+
zIndex: screensCount - index
|
|
2767
|
+
};
|
|
2768
|
+
};
|
|
2253
2769
|
|
|
2254
|
-
var
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
var
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
}, [changeIndex, onInteractionPrivate, setMenuOpened]);
|
|
2269
|
-
var onClickMenuItem = useCallback(function (_ref10) {
|
|
2270
|
-
var itemScreenId = _ref10.screenId;
|
|
2770
|
+
var _useFullscreen = useFullscreen(containerRef.current || null),
|
|
2771
|
+
toggleFullscreen = _useFullscreen.toggle,
|
|
2772
|
+
fullscreenActive = _useFullscreen.active,
|
|
2773
|
+
fullscreenEnabled = _useFullscreen.enabled;
|
|
2774
|
+
|
|
2775
|
+
var menuVisible = screensCount === 0 || currentScreenInteractionEnabled; // Get element height
|
|
2776
|
+
|
|
2777
|
+
var _useDimensionObserver3 = useDimensionObserver(),
|
|
2778
|
+
menuDotsContainerRef = _useDimensionObserver3.ref,
|
|
2779
|
+
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
2780
|
+
menuDotsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
2781
|
+
|
|
2782
|
+
var onClickScreen = useCallback(function (_ref13) {
|
|
2783
|
+
var itemScreenId = _ref13.screenId;
|
|
2271
2784
|
onInteractionPrivate();
|
|
2272
|
-
var index = screens.findIndex(function (
|
|
2273
|
-
var id =
|
|
2785
|
+
var index = screens.findIndex(function (_ref14) {
|
|
2786
|
+
var id = _ref14.id;
|
|
2274
2787
|
return id === itemScreenId;
|
|
2275
2788
|
});
|
|
2276
2789
|
changeIndex(index);
|
|
2277
|
-
|
|
2278
|
-
if (menuOpened) {
|
|
2279
|
-
setMenuOpened(false);
|
|
2280
|
-
}
|
|
2281
|
-
}, [onInteractionPrivate, changeIndex, menuOpened, setMenuOpened]);
|
|
2790
|
+
}, [onInteractionPrivate, changeIndex]);
|
|
2282
2791
|
var onContextMenu = useCallback(function (e) {
|
|
2283
2792
|
if (!landscape) {
|
|
2284
2793
|
e.preventDefault();
|
|
@@ -2286,28 +2795,16 @@ var Viewer = function Viewer(_ref) {
|
|
|
2286
2795
|
}
|
|
2287
2796
|
|
|
2288
2797
|
return true;
|
|
2289
|
-
}, [landscape]);
|
|
2798
|
+
}, [landscape]); // hmm?
|
|
2799
|
+
|
|
2290
2800
|
var overscrollStyle = /*#__PURE__*/React.createElement("style", {
|
|
2291
2801
|
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
|
-
|
|
2802
|
+
}, "body { overscroll-behavior: contain; }");
|
|
2300
2803
|
var keyboardShortcuts = useMemo(function () {
|
|
2301
2804
|
return {
|
|
2302
2805
|
f: function f() {
|
|
2303
2806
|
return toggleFullscreen();
|
|
2304
2807
|
},
|
|
2305
|
-
m: function m() {
|
|
2306
|
-
return setMenuOpened(!menuOpened);
|
|
2307
|
-
},
|
|
2308
|
-
escape: function escape() {
|
|
2309
|
-
return setMenuOpened(false);
|
|
2310
|
-
},
|
|
2311
2808
|
arrowleft: function arrowleft() {
|
|
2312
2809
|
return gotoPreviousScreen();
|
|
2313
2810
|
},
|
|
@@ -2318,55 +2815,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
2318
2815
|
return gotoNextScreen();
|
|
2319
2816
|
}
|
|
2320
2817
|
};
|
|
2321
|
-
}, [
|
|
2818
|
+
}, [gotoPreviousScreen, gotoNextScreen]);
|
|
2322
2819
|
useKeyboardShortcuts(keyboardShortcuts, {
|
|
2323
2820
|
disabled: renderContext !== 'view'
|
|
2324
2821
|
});
|
|
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
2822
|
return /*#__PURE__*/React.createElement(VisitorProvider, {
|
|
2371
2823
|
visitor: visitor
|
|
2372
2824
|
}, /*#__PURE__*/React.createElement(ScreenSizeProvider, {
|
|
@@ -2391,13 +2843,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
2391
2843
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2392
2844
|
className: classNames([styles$6.container, screenSize.screens.map(function (screenName) {
|
|
2393
2845
|
return "story-screen-".concat(screenName);
|
|
2394
|
-
}), (_ref15 = {}, _defineProperty(_ref15, styles$6.landscape, landscape), _defineProperty(_ref15, styles$6.
|
|
2846
|
+
}), (_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
2847
|
ref: containerRef,
|
|
2396
2848
|
onContextMenu: onContextMenu
|
|
2397
2849
|
}, !withoutMenu ? /*#__PURE__*/React.createElement(ViewerMenu, {
|
|
2398
2850
|
story: parsedStory,
|
|
2399
2851
|
currentScreenIndex: screenIndex,
|
|
2400
|
-
opened: menuOpened,
|
|
2401
2852
|
withShadow: menuOverScreen && !withoutMenuShadow,
|
|
2402
2853
|
toggleFullscreen: toggleFullscreen,
|
|
2403
2854
|
fullscreenActive: fullscreenActive,
|
|
@@ -2406,109 +2857,66 @@ var Viewer = function Viewer(_ref) {
|
|
|
2406
2857
|
shareBasePath: basePath,
|
|
2407
2858
|
screenSize: screenSize,
|
|
2408
2859
|
menuWidth: menuIsScreenWidth ? screenContainerWidth : null,
|
|
2860
|
+
theme: viewerTheme,
|
|
2409
2861
|
trackingEnabled: trackingEnabled,
|
|
2410
|
-
|
|
2411
|
-
onClickMenu: onClickMenu,
|
|
2862
|
+
onClickScreen: onClickScreen,
|
|
2412
2863
|
onClickCloseViewer: onCloseViewer,
|
|
2413
|
-
onRequestOpen: onMenuRequestOpen,
|
|
2414
|
-
onRequestClose: onMenuRequestClose,
|
|
2415
2864
|
withDotItemClick: screenContainerWidth > 400,
|
|
2416
2865
|
withoutScreensMenu: withoutScreensMenu,
|
|
2417
2866
|
withoutShareMenu: withoutShareMenu,
|
|
2418
2867
|
refDots: menuDotsContainerRef
|
|
2419
2868
|
}) : null, ready || withoutScreensTransforms ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
2420
|
-
ref: contentRef,
|
|
2421
2869
|
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%', ")");
|
|
2870
|
+
}, dragContentBind()), !withoutNavigationArrow && !withNeighborScreens && screenIndex > 0 && screens.length > 1 ? /*#__PURE__*/React.createElement(NavigationButton, {
|
|
2871
|
+
direction: "previous",
|
|
2872
|
+
className: classNames([styles$6.navButton, styles$6.previous]),
|
|
2873
|
+
onClick: gotoPreviousScreen
|
|
2874
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
2875
|
+
className: styles$6.screensFrame,
|
|
2876
|
+
style: {
|
|
2877
|
+
width: screenContainerWidth,
|
|
2878
|
+
height: screenContainerHeight,
|
|
2879
|
+
overflow: !withNeighborScreens ? 'hidden' : null
|
|
2448
2880
|
}
|
|
2881
|
+
}, screens.map(function (screen, i) {
|
|
2882
|
+
var current = i === Math.round(screenIndexProgress); // base current on transition
|
|
2449
2883
|
|
|
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, {
|
|
2884
|
+
var active = i >= screenIndex - neighborScreensActive && i <= screenIndex + neighborScreensActive;
|
|
2885
|
+
var defaultStyles = {
|
|
2886
|
+
opacity: current ? 1 : 0
|
|
2887
|
+
};
|
|
2888
|
+
var screenStyles = active ? getScreenStylesByIndex(i, screenIndexProgress) : defaultStyles;
|
|
2889
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2890
|
+
key: "screen-viewer-".concat(screen.id || '', "-").concat(i + 1),
|
|
2891
|
+
style: screenStyles,
|
|
2892
|
+
className: classNames([styles$6.screenContainer, _defineProperty({}, styles$6.current, current)])
|
|
2893
|
+
}, screen !== null && active ? /*#__PURE__*/React.createElement(ViewerScreen, {
|
|
2482
2894
|
className: styles$6.screen,
|
|
2483
|
-
screen:
|
|
2895
|
+
screen: screen,
|
|
2484
2896
|
screenState: current ? screenState : null,
|
|
2485
|
-
renderContext: renderContext,
|
|
2486
2897
|
index: i,
|
|
2487
2898
|
current: current,
|
|
2488
2899
|
active: active,
|
|
2489
2900
|
mediaRef: function mediaRef(ref) {
|
|
2490
2901
|
screensMediasRef.current[i] = ref;
|
|
2491
2902
|
},
|
|
2903
|
+
renderContext: renderContext,
|
|
2492
2904
|
width: screenWidth,
|
|
2493
2905
|
height: screenHeight,
|
|
2494
|
-
scale: screenScale
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
}), !withoutPlaybackControls ? /*#__PURE__*/React.createElement("div", {
|
|
2906
|
+
scale: screenScale
|
|
2907
|
+
}) : null);
|
|
2908
|
+
})), !withoutNavigationArrow && !withNeighborScreens && screenIndex < screens.length - 1 ? /*#__PURE__*/React.createElement(NavigationButton, {
|
|
2909
|
+
direction: "next",
|
|
2910
|
+
className: classNames([styles$6.navButton, styles$6.next]),
|
|
2911
|
+
onClick: gotoNextScreen
|
|
2912
|
+
}) : null, !withoutPlaybackControls ? /*#__PURE__*/React.createElement("div", {
|
|
2502
2913
|
className: styles$6.playbackControls,
|
|
2503
2914
|
ref: playbackControlsContainerRef
|
|
2504
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
2505
|
-
className: styles$6.playbackControlsContainer,
|
|
2506
|
-
style: {
|
|
2507
|
-
width: screenContainerWidth
|
|
2508
|
-
}
|
|
2509
2915
|
}, /*#__PURE__*/React.createElement(PlaybackControls, {
|
|
2510
2916
|
className: styles$6.controls
|
|
2511
|
-
}))
|
|
2917
|
+
})) : null, withNavigationHint && !withNeighborScreens && screenIndex === 0 && !hasInteracted ? /*#__PURE__*/React.createElement(ArrowHint, {
|
|
2918
|
+
className: styles$6.arrowHint
|
|
2919
|
+
}) : null) : null, /*#__PURE__*/React.createElement(WebViewContainer, {
|
|
2512
2920
|
className: styles$6.webView,
|
|
2513
2921
|
style: {
|
|
2514
2922
|
maxWidth: Math.max(screenContainerWidth, 600)
|