@micromag/screen-gallery 0.4.49 → 0.4.50
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 +111 -101
- package/package.json +12 -12
package/es/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import isPlainObject from 'lodash/isPlainObject';
|
|
8
|
-
import
|
|
8
|
+
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
9
9
|
import { ScreenElement } from '@micromag/core/components';
|
|
10
10
|
import { useScreenSize, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useScreenRenderContext } from '@micromag/core/contexts';
|
|
11
11
|
import { useDimensionObserver } from '@micromag/core/hooks';
|
|
@@ -17,6 +17,7 @@ import Grid from '@micromag/element-grid';
|
|
|
17
17
|
import Header from '@micromag/element-header';
|
|
18
18
|
import Text from '@micromag/element-text';
|
|
19
19
|
import Visual from '@micromag/element-visual';
|
|
20
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
20
21
|
import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
|
|
21
22
|
import _extends from '@babel/runtime/helpers/extends';
|
|
22
23
|
|
|
@@ -321,115 +322,124 @@ function GalleryScreen(_ref) {
|
|
|
321
322
|
var _ref4 = caption || {},
|
|
322
323
|
_ref4$textStyle = _ref4.textStyle,
|
|
323
324
|
textStyle = _ref4$textStyle === void 0 ? null : _ref4$textStyle;
|
|
324
|
-
return /*#__PURE__*/
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
325
|
+
return /*#__PURE__*/jsxs("div", {
|
|
326
|
+
className: styles.gridItem,
|
|
327
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
328
|
+
className: styles.imageContainer,
|
|
329
|
+
ref: function ref(el) {
|
|
330
|
+
imagesEl.current[itemI] = el;
|
|
331
|
+
},
|
|
332
|
+
children: /*#__PURE__*/jsx(ScreenElement, {
|
|
333
|
+
placeholder: "image",
|
|
334
|
+
placeholderProps: {
|
|
335
|
+
className: styles.placeholder,
|
|
336
|
+
height: '100%'
|
|
337
|
+
},
|
|
338
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
339
|
+
id: "ebsPd4",
|
|
340
|
+
defaultMessage: [{
|
|
341
|
+
"type": 0,
|
|
342
|
+
"value": "Image"
|
|
343
|
+
}]
|
|
344
|
+
}),
|
|
345
|
+
emptyClassName: styles.emptyImage,
|
|
346
|
+
isEmpty: !hasImage,
|
|
347
|
+
children: active || current ? /*#__PURE__*/jsx(Visual, _objectSpread(_objectSpread(_objectSpread({
|
|
348
|
+
className: styles.image
|
|
349
|
+
}, finalImage), imageSize), {}, {
|
|
350
|
+
loadingMode: "lazy",
|
|
351
|
+
resolution: resolution,
|
|
352
|
+
objectFit: {
|
|
353
|
+
fit: 'cover'
|
|
354
|
+
},
|
|
355
|
+
playing: backgroundPlaying,
|
|
356
|
+
active: active,
|
|
357
|
+
shouldLoad: mediaShouldLoad,
|
|
358
|
+
withoutVideo: isPreview,
|
|
359
|
+
onLoaded: onImageLoaded
|
|
360
|
+
})) : null
|
|
361
|
+
})
|
|
362
|
+
}), withCaptions ? /*#__PURE__*/jsx(ScreenElement, {
|
|
363
|
+
placeholder: "line",
|
|
364
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
365
|
+
id: "6tIigB",
|
|
366
|
+
defaultMessage: [{
|
|
367
|
+
"type": 0,
|
|
368
|
+
"value": "Caption"
|
|
369
|
+
}]
|
|
370
|
+
}),
|
|
371
|
+
emptyClassName: styles.emptyCaption,
|
|
372
|
+
isEmpty: !hasCaption,
|
|
373
|
+
children: /*#__PURE__*/jsx("div", {
|
|
374
|
+
className: styles.caption,
|
|
375
|
+
children: /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, caption), {}, {
|
|
376
|
+
className: styles.captionText,
|
|
377
|
+
lineClamp: captionMaxLines,
|
|
378
|
+
textStyle: _objectSpread(_objectSpread({}, imageCaptionStyle || null), textStyle)
|
|
379
|
+
}))
|
|
380
|
+
})
|
|
381
|
+
}) : null]
|
|
382
|
+
}, "item-".concat(itemI));
|
|
383
|
+
});
|
|
384
|
+
return /*#__PURE__*/jsxs("div", {
|
|
385
|
+
className: classNames([styles.container, className, _defineProperty({}, styles.isPlaceholder, isPlaceholder)]),
|
|
386
|
+
"data-screen-ready": ready,
|
|
387
|
+
children: [/*#__PURE__*/jsx(Container, {
|
|
388
|
+
width: width,
|
|
389
|
+
height: height,
|
|
390
|
+
className: styles.content,
|
|
391
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
392
|
+
className: styles.inner,
|
|
393
|
+
style: {
|
|
394
|
+
paddingTop: (hasHeader ? headerHeight : 0) + (!isPreview ? viewerTopHeight : 0),
|
|
395
|
+
paddingBottom: (hasFooter ? footerHeight : 0) + (current && !isPreview ? viewerBottomHeight : 0)
|
|
396
|
+
},
|
|
397
|
+
ref: contentRef,
|
|
398
|
+
children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
399
|
+
className: styles.header,
|
|
400
|
+
ref: headerRef,
|
|
401
|
+
style: {
|
|
402
|
+
paddingTop: hasHeader ? finalSpacing / 2 : spacing,
|
|
403
|
+
paddingLeft: spacing,
|
|
404
|
+
paddingRight: spacing,
|
|
405
|
+
transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
|
|
406
|
+
},
|
|
407
|
+
children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
|
|
408
|
+
}) : null, /*#__PURE__*/jsx(Grid, _objectSpread({
|
|
409
|
+
className: styles.grid,
|
|
410
|
+
spacing: finalSpacing,
|
|
411
|
+
items: items
|
|
412
|
+
}, grid)), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
413
|
+
className: styles.footer,
|
|
414
|
+
ref: footerRef,
|
|
415
|
+
style: {
|
|
416
|
+
paddingLeft: Math.max(finalSpacing / 2, viewerBottomSidesWidth),
|
|
417
|
+
paddingRight: Math.max(finalSpacing / 2, viewerBottomSidesWidth),
|
|
418
|
+
// paddingTop: finalSpacing / 2,
|
|
419
|
+
paddingBottom: finalSpacing / 2,
|
|
420
|
+
transform: !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null
|
|
421
|
+
},
|
|
422
|
+
children: /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps))
|
|
423
|
+
}) : null]
|
|
424
|
+
})
|
|
425
|
+
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
426
|
+
background: background,
|
|
427
|
+
width: width,
|
|
428
|
+
height: height,
|
|
351
429
|
resolution: resolution,
|
|
352
|
-
objectFit: {
|
|
353
|
-
fit: 'cover'
|
|
354
|
-
},
|
|
355
430
|
playing: backgroundPlaying,
|
|
356
|
-
|
|
431
|
+
muted: muted,
|
|
357
432
|
shouldLoad: mediaShouldLoad,
|
|
433
|
+
mediaRef: mediaRef,
|
|
358
434
|
withoutVideo: isPreview,
|
|
359
|
-
|
|
360
|
-
})
|
|
361
|
-
placeholder: "line",
|
|
362
|
-
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
363
|
-
id: "6tIigB",
|
|
364
|
-
defaultMessage: [{
|
|
365
|
-
"type": 0,
|
|
366
|
-
"value": "Caption"
|
|
367
|
-
}]
|
|
368
|
-
}),
|
|
369
|
-
emptyClassName: styles.emptyCaption,
|
|
370
|
-
isEmpty: !hasCaption
|
|
371
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
372
|
-
className: styles.caption
|
|
373
|
-
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, caption, {
|
|
374
|
-
className: styles.captionText,
|
|
375
|
-
lineClamp: captionMaxLines,
|
|
376
|
-
textStyle: _objectSpread(_objectSpread({}, imageCaptionStyle || null), textStyle)
|
|
377
|
-
})))) : null);
|
|
435
|
+
className: styles.background
|
|
436
|
+
}) : null]
|
|
378
437
|
});
|
|
379
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
380
|
-
className: classNames([styles.container, className, _defineProperty({}, styles.isPlaceholder, isPlaceholder)]),
|
|
381
|
-
"data-screen-ready": ready
|
|
382
|
-
}, /*#__PURE__*/React.createElement(Container, {
|
|
383
|
-
width: width,
|
|
384
|
-
height: height,
|
|
385
|
-
className: styles.content
|
|
386
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
387
|
-
className: styles.inner,
|
|
388
|
-
style: {
|
|
389
|
-
paddingTop: (hasHeader ? headerHeight : 0) + (!isPreview ? viewerTopHeight : 0),
|
|
390
|
-
paddingBottom: (hasFooter ? footerHeight : 0) + (current && !isPreview ? viewerBottomHeight : 0)
|
|
391
|
-
},
|
|
392
|
-
ref: contentRef
|
|
393
|
-
}, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
|
|
394
|
-
className: styles.header,
|
|
395
|
-
ref: headerRef,
|
|
396
|
-
style: {
|
|
397
|
-
paddingTop: hasHeader ? finalSpacing / 2 : spacing,
|
|
398
|
-
paddingLeft: spacing,
|
|
399
|
-
paddingRight: spacing,
|
|
400
|
-
transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
|
|
401
|
-
}
|
|
402
|
-
}, /*#__PURE__*/React.createElement(Header, header)) : null, /*#__PURE__*/React.createElement(Grid, Object.assign({
|
|
403
|
-
className: styles.grid,
|
|
404
|
-
spacing: finalSpacing,
|
|
405
|
-
items: items
|
|
406
|
-
}, grid)), !isPlaceholder && hasFooter ? /*#__PURE__*/React.createElement("div", {
|
|
407
|
-
className: styles.footer,
|
|
408
|
-
ref: footerRef,
|
|
409
|
-
style: {
|
|
410
|
-
paddingLeft: Math.max(finalSpacing / 2, viewerBottomSidesWidth),
|
|
411
|
-
paddingRight: Math.max(finalSpacing / 2, viewerBottomSidesWidth),
|
|
412
|
-
// paddingTop: finalSpacing / 2,
|
|
413
|
-
paddingBottom: finalSpacing / 2,
|
|
414
|
-
transform: !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null
|
|
415
|
-
}
|
|
416
|
-
}, /*#__PURE__*/React.createElement(Footer, footerProps)) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
417
|
-
background: background,
|
|
418
|
-
width: width,
|
|
419
|
-
height: height,
|
|
420
|
-
resolution: resolution,
|
|
421
|
-
playing: backgroundPlaying,
|
|
422
|
-
muted: muted,
|
|
423
|
-
shouldLoad: mediaShouldLoad,
|
|
424
|
-
mediaRef: mediaRef,
|
|
425
|
-
withoutVideo: isPreview,
|
|
426
|
-
className: styles.background
|
|
427
|
-
}) : null);
|
|
428
438
|
}
|
|
429
439
|
|
|
430
440
|
function GalleryCaptionsScreen(_ref) {
|
|
431
441
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
432
|
-
return /*#__PURE__*/
|
|
442
|
+
return /*#__PURE__*/jsx(GalleryScreen, _objectSpread(_objectSpread({}, props), {}, {
|
|
433
443
|
withCaptions: true
|
|
434
444
|
}));
|
|
435
445
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-gallery",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/runtime": "^7.28.6",
|
|
64
|
-
"@micromag/core": "^0.4.
|
|
65
|
-
"@micromag/element-background": "^0.4.
|
|
66
|
-
"@micromag/element-container": "^0.4.
|
|
67
|
-
"@micromag/element-footer": "^0.4.
|
|
68
|
-
"@micromag/element-grid": "^0.4.
|
|
69
|
-
"@micromag/element-header": "^0.4.
|
|
70
|
-
"@micromag/element-layout": "^0.4.
|
|
71
|
-
"@micromag/element-text": "^0.4.
|
|
72
|
-
"@micromag/element-visual": "^0.4.
|
|
73
|
-
"@micromag/transforms": "^0.4.
|
|
64
|
+
"@micromag/core": "^0.4.50",
|
|
65
|
+
"@micromag/element-background": "^0.4.50",
|
|
66
|
+
"@micromag/element-container": "^0.4.50",
|
|
67
|
+
"@micromag/element-footer": "^0.4.50",
|
|
68
|
+
"@micromag/element-grid": "^0.4.50",
|
|
69
|
+
"@micromag/element-header": "^0.4.50",
|
|
70
|
+
"@micromag/element-layout": "^0.4.50",
|
|
71
|
+
"@micromag/element-text": "^0.4.50",
|
|
72
|
+
"@micromag/element-visual": "^0.4.50",
|
|
73
|
+
"@micromag/transforms": "^0.4.50",
|
|
74
74
|
"classnames": "^2.2.6",
|
|
75
75
|
"lodash": "^4.17.23",
|
|
76
76
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"access": "public",
|
|
81
81
|
"registry": "https://registry.npmjs.org/"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
84
84
|
"types": "es/index.d.ts"
|
|
85
85
|
}
|