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