@micromag/viewer 0.3.42 → 0.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +59 -46
- package/lib/index.js +59 -46
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -727,7 +727,7 @@ var propTypes$5 = {
|
|
|
727
727
|
onClickItem: PropTypes.func,
|
|
728
728
|
onClose: PropTypes.func,
|
|
729
729
|
onShare: PropTypes.func,
|
|
730
|
-
|
|
730
|
+
maxThumbsWidth: PropTypes.number,
|
|
731
731
|
toggleFullscreen: PropTypes.func,
|
|
732
732
|
fullscreenActive: PropTypes.bool,
|
|
733
733
|
fullscreenEnabled: PropTypes.bool,
|
|
@@ -744,7 +744,7 @@ var defaultProps$5 = {
|
|
|
744
744
|
onClickItem: null,
|
|
745
745
|
onClose: null,
|
|
746
746
|
onShare: null,
|
|
747
|
-
|
|
747
|
+
maxThumbsWidth: 140,
|
|
748
748
|
toggleFullscreen: null,
|
|
749
749
|
fullscreenActive: false,
|
|
750
750
|
fullscreenEnabled: false,
|
|
@@ -762,7 +762,7 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
762
762
|
onClickItem = _ref.onClickItem,
|
|
763
763
|
onClose = _ref.onClose,
|
|
764
764
|
onShare = _ref.onShare,
|
|
765
|
-
|
|
765
|
+
maxThumbsWidth = _ref.maxThumbsWidth,
|
|
766
766
|
toggleFullscreen = _ref.toggleFullscreen,
|
|
767
767
|
fullscreenActive = _ref.fullscreenActive,
|
|
768
768
|
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
@@ -777,48 +777,57 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
777
777
|
firstScreenContainerRef = _useResizeObserver.ref,
|
|
778
778
|
firstScreenContentRect = _useResizeObserver.entry.contentRect;
|
|
779
779
|
|
|
780
|
+
var _useResizeObserver2 = useResizeObserver(),
|
|
781
|
+
containerRef = _useResizeObserver2.ref,
|
|
782
|
+
containerRect = _useResizeObserver2.entry.contentRect;
|
|
783
|
+
|
|
780
784
|
var _ref3 = firstScreenContentRect || {},
|
|
781
785
|
_ref3$width = _ref3.width,
|
|
782
|
-
thumbWidth = _ref3$width === void 0 ? 0 : _ref3$width;
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
_ref4$
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
_ref5$
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
_ref6$
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
_ref7$
|
|
807
|
-
|
|
808
|
-
_ref7$
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
_ref8$
|
|
813
|
-
|
|
786
|
+
thumbWidth = _ref3$width === void 0 ? 0 : _ref3$width;
|
|
787
|
+
|
|
788
|
+
var _ref4 = containerRect || {},
|
|
789
|
+
_ref4$width = _ref4.width,
|
|
790
|
+
contentWidth = _ref4$width === void 0 ? 0 : _ref4$width;
|
|
791
|
+
|
|
792
|
+
var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // Viewer theme
|
|
793
|
+
|
|
794
|
+
var _ref5 = viewerTheme || {},
|
|
795
|
+
_ref5$colors = _ref5.colors,
|
|
796
|
+
colors = _ref5$colors === void 0 ? null : _ref5$colors,
|
|
797
|
+
_ref5$background = _ref5.background,
|
|
798
|
+
background = _ref5$background === void 0 ? null : _ref5$background,
|
|
799
|
+
_ref5$textStyles = _ref5.textStyles,
|
|
800
|
+
textStyles = _ref5$textStyles === void 0 ? null : _ref5$textStyles,
|
|
801
|
+
_ref5$logo = _ref5.logo,
|
|
802
|
+
brandLogo = _ref5$logo === void 0 ? null : _ref5$logo;
|
|
803
|
+
|
|
804
|
+
var _ref6 = textStyles || {},
|
|
805
|
+
_ref6$title = _ref6.title,
|
|
806
|
+
brandTextStyle = _ref6$title === void 0 ? null : _ref6$title;
|
|
807
|
+
|
|
808
|
+
var _ref7 = colors || {},
|
|
809
|
+
_ref7$primary = _ref7.primary,
|
|
810
|
+
brandPrimaryColor = _ref7$primary === void 0 ? null : _ref7$primary,
|
|
811
|
+
_ref7$secondary = _ref7.secondary,
|
|
812
|
+
brandSecondaryColor = _ref7$secondary === void 0 ? null : _ref7$secondary;
|
|
813
|
+
|
|
814
|
+
var _ref8 = background || {},
|
|
815
|
+
_ref8$color = _ref8.color,
|
|
816
|
+
brandBackgroundColor = _ref8$color === void 0 ? null : _ref8$color,
|
|
817
|
+
_ref8$image = _ref8.image,
|
|
818
|
+
image = _ref8$image === void 0 ? null : _ref8$image;
|
|
819
|
+
|
|
820
|
+
var _ref9 = image || {},
|
|
821
|
+
_ref9$url = _ref9.url,
|
|
822
|
+
brandImageUrl = _ref9$url === void 0 ? null : _ref9$url;
|
|
814
823
|
|
|
815
824
|
var borderPrimaryColorStyle = getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
816
825
|
var colorSecondaryColorStyle = getStyleFromColor(brandSecondaryColor, 'color');
|
|
817
826
|
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
818
827
|
|
|
819
|
-
var
|
|
820
|
-
|
|
821
|
-
brandLogoUrl =
|
|
828
|
+
var _ref10 = brandLogo || {},
|
|
829
|
+
_ref10$url = _ref10.url,
|
|
830
|
+
brandLogoUrl = _ref10$url === void 0 ? null : _ref10$url;
|
|
822
831
|
|
|
823
832
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
824
833
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
@@ -830,11 +839,11 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
830
839
|
scrolledBottom = _useState2[0],
|
|
831
840
|
setScrolledBottom = _useState2[1];
|
|
832
841
|
|
|
833
|
-
var dragBind = useDrag(function (
|
|
834
|
-
var
|
|
835
|
-
dy =
|
|
836
|
-
last =
|
|
837
|
-
tap =
|
|
842
|
+
var dragBind = useDrag(function (_ref11) {
|
|
843
|
+
var _ref11$direction = _slicedToArray(_ref11.direction, 2),
|
|
844
|
+
dy = _ref11$direction[1],
|
|
845
|
+
last = _ref11.last,
|
|
846
|
+
tap = _ref11.tap;
|
|
838
847
|
|
|
839
848
|
if (!tap && last && scrolledBottom && dy < 0 && onClose !== null) {
|
|
840
849
|
onClose();
|
|
@@ -923,7 +932,8 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
923
932
|
className: styles$3.icon,
|
|
924
933
|
icon: faTimes
|
|
925
934
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
926
|
-
className: styles$3.content
|
|
935
|
+
className: styles$3.content,
|
|
936
|
+
ref: containerRef
|
|
927
937
|
}, /*#__PURE__*/React.createElement(Scroll, {
|
|
928
938
|
className: styles$3.scroll,
|
|
929
939
|
onScrolledBottom: onScrolledBottom,
|
|
@@ -1364,6 +1374,7 @@ var propTypes$2 = {
|
|
|
1364
1374
|
withMetadata: PropTypes.bool,
|
|
1365
1375
|
withoutMenu: PropTypes.bool,
|
|
1366
1376
|
withoutScreensMenu: PropTypes.bool,
|
|
1377
|
+
withoutMenuShadow: PropTypes.bool,
|
|
1367
1378
|
withoutFullscreen: PropTypes.bool,
|
|
1368
1379
|
withLandscapeSiblingsScreens: PropTypes.bool,
|
|
1369
1380
|
closeable: PropTypes.bool,
|
|
@@ -1399,6 +1410,7 @@ var defaultProps$2 = {
|
|
|
1399
1410
|
withMetadata: false,
|
|
1400
1411
|
withoutMenu: false,
|
|
1401
1412
|
withoutScreensMenu: false,
|
|
1413
|
+
withoutMenuShadow: false,
|
|
1402
1414
|
withoutFullscreen: false,
|
|
1403
1415
|
withLandscapeSiblingsScreens: false,
|
|
1404
1416
|
menuIsScreenWidth: false,
|
|
@@ -1432,7 +1444,8 @@ var Viewer = function Viewer(_ref) {
|
|
|
1432
1444
|
landscapeScreenMargin = _ref.landscapeScreenMargin,
|
|
1433
1445
|
withMetadata = _ref.withMetadata,
|
|
1434
1446
|
withoutMenu = _ref.withoutMenu,
|
|
1435
|
-
withoutScreensMenu = _ref.withoutScreensMenu
|
|
1447
|
+
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1448
|
+
withoutMenuShadow = _ref.withoutMenuShadow;
|
|
1436
1449
|
_ref.withoutFullscreen;
|
|
1437
1450
|
var withLandscapeSiblingsScreens = _ref.withLandscapeSiblingsScreens,
|
|
1438
1451
|
menuIsScreenWidth = _ref.menuIsScreenWidth,
|
|
@@ -1719,7 +1732,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
1719
1732
|
story: parsedStory,
|
|
1720
1733
|
currentScreenIndex: screenIndex,
|
|
1721
1734
|
opened: menuOpened,
|
|
1722
|
-
withShadow: menuOverScreen,
|
|
1735
|
+
withShadow: menuOverScreen && !withoutMenuShadow,
|
|
1723
1736
|
toggleFullscreen: toggleFullscreen,
|
|
1724
1737
|
fullscreenActive: fullscreenActive,
|
|
1725
1738
|
fullscreenEnabled: fullscreenEnabled,
|
package/lib/index.js
CHANGED
|
@@ -745,7 +745,7 @@ var propTypes$5 = {
|
|
|
745
745
|
onClickItem: PropTypes__default["default"].func,
|
|
746
746
|
onClose: PropTypes__default["default"].func,
|
|
747
747
|
onShare: PropTypes__default["default"].func,
|
|
748
|
-
|
|
748
|
+
maxThumbsWidth: PropTypes__default["default"].number,
|
|
749
749
|
toggleFullscreen: PropTypes__default["default"].func,
|
|
750
750
|
fullscreenActive: PropTypes__default["default"].bool,
|
|
751
751
|
fullscreenEnabled: PropTypes__default["default"].bool,
|
|
@@ -762,7 +762,7 @@ var defaultProps$5 = {
|
|
|
762
762
|
onClickItem: null,
|
|
763
763
|
onClose: null,
|
|
764
764
|
onShare: null,
|
|
765
|
-
|
|
765
|
+
maxThumbsWidth: 140,
|
|
766
766
|
toggleFullscreen: null,
|
|
767
767
|
fullscreenActive: false,
|
|
768
768
|
fullscreenEnabled: false,
|
|
@@ -780,7 +780,7 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
780
780
|
onClickItem = _ref.onClickItem,
|
|
781
781
|
onClose = _ref.onClose,
|
|
782
782
|
onShare = _ref.onShare,
|
|
783
|
-
|
|
783
|
+
maxThumbsWidth = _ref.maxThumbsWidth,
|
|
784
784
|
toggleFullscreen = _ref.toggleFullscreen,
|
|
785
785
|
fullscreenActive = _ref.fullscreenActive,
|
|
786
786
|
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
@@ -795,48 +795,57 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
795
795
|
firstScreenContainerRef = _useResizeObserver.ref,
|
|
796
796
|
firstScreenContentRect = _useResizeObserver.entry.contentRect;
|
|
797
797
|
|
|
798
|
+
var _useResizeObserver2 = hooks.useResizeObserver(),
|
|
799
|
+
containerRef = _useResizeObserver2.ref,
|
|
800
|
+
containerRect = _useResizeObserver2.entry.contentRect;
|
|
801
|
+
|
|
798
802
|
var _ref3 = firstScreenContentRect || {},
|
|
799
803
|
_ref3$width = _ref3.width,
|
|
800
|
-
thumbWidth = _ref3$width === void 0 ? 0 : _ref3$width;
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
_ref4$
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
_ref5$
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
_ref6$
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
_ref7$
|
|
825
|
-
|
|
826
|
-
_ref7$
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
_ref8$
|
|
831
|
-
|
|
804
|
+
thumbWidth = _ref3$width === void 0 ? 0 : _ref3$width;
|
|
805
|
+
|
|
806
|
+
var _ref4 = containerRect || {},
|
|
807
|
+
_ref4$width = _ref4.width,
|
|
808
|
+
contentWidth = _ref4$width === void 0 ? 0 : _ref4$width;
|
|
809
|
+
|
|
810
|
+
var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // Viewer theme
|
|
811
|
+
|
|
812
|
+
var _ref5 = viewerTheme || {},
|
|
813
|
+
_ref5$colors = _ref5.colors,
|
|
814
|
+
colors = _ref5$colors === void 0 ? null : _ref5$colors,
|
|
815
|
+
_ref5$background = _ref5.background,
|
|
816
|
+
background = _ref5$background === void 0 ? null : _ref5$background,
|
|
817
|
+
_ref5$textStyles = _ref5.textStyles,
|
|
818
|
+
textStyles = _ref5$textStyles === void 0 ? null : _ref5$textStyles,
|
|
819
|
+
_ref5$logo = _ref5.logo,
|
|
820
|
+
brandLogo = _ref5$logo === void 0 ? null : _ref5$logo;
|
|
821
|
+
|
|
822
|
+
var _ref6 = textStyles || {},
|
|
823
|
+
_ref6$title = _ref6.title,
|
|
824
|
+
brandTextStyle = _ref6$title === void 0 ? null : _ref6$title;
|
|
825
|
+
|
|
826
|
+
var _ref7 = colors || {},
|
|
827
|
+
_ref7$primary = _ref7.primary,
|
|
828
|
+
brandPrimaryColor = _ref7$primary === void 0 ? null : _ref7$primary,
|
|
829
|
+
_ref7$secondary = _ref7.secondary,
|
|
830
|
+
brandSecondaryColor = _ref7$secondary === void 0 ? null : _ref7$secondary;
|
|
831
|
+
|
|
832
|
+
var _ref8 = background || {},
|
|
833
|
+
_ref8$color = _ref8.color,
|
|
834
|
+
brandBackgroundColor = _ref8$color === void 0 ? null : _ref8$color,
|
|
835
|
+
_ref8$image = _ref8.image,
|
|
836
|
+
image = _ref8$image === void 0 ? null : _ref8$image;
|
|
837
|
+
|
|
838
|
+
var _ref9 = image || {},
|
|
839
|
+
_ref9$url = _ref9.url,
|
|
840
|
+
brandImageUrl = _ref9$url === void 0 ? null : _ref9$url;
|
|
832
841
|
|
|
833
842
|
var borderPrimaryColorStyle = utils.getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
834
843
|
var colorSecondaryColorStyle = utils.getStyleFromColor(brandSecondaryColor, 'color');
|
|
835
844
|
var backgroundColorStyle = utils.getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
836
845
|
|
|
837
|
-
var
|
|
838
|
-
|
|
839
|
-
brandLogoUrl =
|
|
846
|
+
var _ref10 = brandLogo || {},
|
|
847
|
+
_ref10$url = _ref10.url,
|
|
848
|
+
brandLogoUrl = _ref10$url === void 0 ? null : _ref10$url;
|
|
840
849
|
|
|
841
850
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
842
851
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
@@ -848,11 +857,11 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
848
857
|
scrolledBottom = _useState2[0],
|
|
849
858
|
setScrolledBottom = _useState2[1];
|
|
850
859
|
|
|
851
|
-
var dragBind = react.useDrag(function (
|
|
852
|
-
var
|
|
853
|
-
dy =
|
|
854
|
-
last =
|
|
855
|
-
tap =
|
|
860
|
+
var dragBind = react.useDrag(function (_ref11) {
|
|
861
|
+
var _ref11$direction = _slicedToArray__default["default"](_ref11.direction, 2),
|
|
862
|
+
dy = _ref11$direction[1],
|
|
863
|
+
last = _ref11.last,
|
|
864
|
+
tap = _ref11.tap;
|
|
856
865
|
|
|
857
866
|
if (!tap && last && scrolledBottom && dy < 0 && onClose !== null) {
|
|
858
867
|
onClose();
|
|
@@ -941,7 +950,8 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
941
950
|
className: styles$3.icon,
|
|
942
951
|
icon: freeSolidSvgIcons.faTimes
|
|
943
952
|
})))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
944
|
-
className: styles$3.content
|
|
953
|
+
className: styles$3.content,
|
|
954
|
+
ref: containerRef
|
|
945
955
|
}, /*#__PURE__*/React__default["default"].createElement(Scroll__default["default"], {
|
|
946
956
|
className: styles$3.scroll,
|
|
947
957
|
onScrolledBottom: onScrolledBottom,
|
|
@@ -1382,6 +1392,7 @@ var propTypes$2 = {
|
|
|
1382
1392
|
withMetadata: PropTypes__default["default"].bool,
|
|
1383
1393
|
withoutMenu: PropTypes__default["default"].bool,
|
|
1384
1394
|
withoutScreensMenu: PropTypes__default["default"].bool,
|
|
1395
|
+
withoutMenuShadow: PropTypes__default["default"].bool,
|
|
1385
1396
|
withoutFullscreen: PropTypes__default["default"].bool,
|
|
1386
1397
|
withLandscapeSiblingsScreens: PropTypes__default["default"].bool,
|
|
1387
1398
|
closeable: PropTypes__default["default"].bool,
|
|
@@ -1417,6 +1428,7 @@ var defaultProps$2 = {
|
|
|
1417
1428
|
withMetadata: false,
|
|
1418
1429
|
withoutMenu: false,
|
|
1419
1430
|
withoutScreensMenu: false,
|
|
1431
|
+
withoutMenuShadow: false,
|
|
1420
1432
|
withoutFullscreen: false,
|
|
1421
1433
|
withLandscapeSiblingsScreens: false,
|
|
1422
1434
|
menuIsScreenWidth: false,
|
|
@@ -1450,7 +1462,8 @@ var Viewer = function Viewer(_ref) {
|
|
|
1450
1462
|
landscapeScreenMargin = _ref.landscapeScreenMargin,
|
|
1451
1463
|
withMetadata = _ref.withMetadata,
|
|
1452
1464
|
withoutMenu = _ref.withoutMenu,
|
|
1453
|
-
withoutScreensMenu = _ref.withoutScreensMenu
|
|
1465
|
+
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1466
|
+
withoutMenuShadow = _ref.withoutMenuShadow;
|
|
1454
1467
|
_ref.withoutFullscreen;
|
|
1455
1468
|
var withLandscapeSiblingsScreens = _ref.withLandscapeSiblingsScreens,
|
|
1456
1469
|
menuIsScreenWidth = _ref.menuIsScreenWidth,
|
|
@@ -1737,7 +1750,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
1737
1750
|
story: parsedStory,
|
|
1738
1751
|
currentScreenIndex: screenIndex,
|
|
1739
1752
|
opened: menuOpened,
|
|
1740
|
-
withShadow: menuOverScreen,
|
|
1753
|
+
withShadow: menuOverScreen && !withoutMenuShadow,
|
|
1741
1754
|
toggleFullscreen: toggleFullscreen,
|
|
1742
1755
|
fullscreenActive: fullscreenActive,
|
|
1743
1756
|
fullscreenEnabled: fullscreenEnabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/viewer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.45",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
62
62
|
"@micromag/core": "^0.3.42",
|
|
63
63
|
"@micromag/element-scroll": "^0.3.42",
|
|
64
|
-
"@micromag/elements": "^0.3.
|
|
64
|
+
"@micromag/elements": "^0.3.45",
|
|
65
65
|
"@micromag/fields": "^0.3.42",
|
|
66
66
|
"@micromag/intl": "^0.3.42",
|
|
67
|
-
"@micromag/screens": "^0.3.
|
|
67
|
+
"@micromag/screens": "^0.3.45",
|
|
68
68
|
"@react-spring/core": "^9.1.1",
|
|
69
69
|
"@react-spring/web": "^9.1.1",
|
|
70
70
|
"@use-gesture/react": "^10.2.4",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "c36f6e7d2bff89a65b20cd51e74139158f7d8dda"
|
|
85
85
|
}
|